CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

My mmc can't save information!!!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








My mmc can't save information!!!
PostPosted: Fri Nov 07, 2008 3:04 am     Reply with quote

Hi
I wrote this code with the mmcsd.c library, but I don't know why it doesn't work.
Code:
#include "mmc.h"
#include "mmcsd.c"
#include "input.c"

void main()
{
   char str[100];
   byte a;
   char T;
   int16 i;

   mmcsd_init();
   delay_ms(500);
   
      if (mmcsd_init())
   {
      printf("Could not init the MMC/SD!!!!");
      while(TRUE);
   }
 
   while(1)
   {
     printf("READ OR WRITE???:-->\r\n");

       T=getc();
     
     putc(T);
     if (T=='w')
     {
        printf("\r\nYour Text:\r\n");
        get_string(str, 20);
        for(i=0;i<=60;i++)
        {
          mmcsd_write_byte(i,str[i]);
          delay_ms(1);
         
        }
        mmcsd_flush_buffer();
       
        printf("\r\nwrite finished!!\r\n");
     }
     if (T == 'r')
     {
       for(i=0;i<=1000;i++)
       {
          mmcsd_read_byte(i,&a);
          printf("%c",a);
       }
       mmcsd_flush_buffer();
       printf("\r\n");
     }
     
   }
}


For example in this code I write 'w' to write a string with 20 character length. I do it and write 'r' for read and it works very well. But when I want to read this string from MMC for a second time, the PIC returns NULL characters.
I tested the "ex_mmcsd.c" example and I get same result. Do you know where the problem is, and what's the correct way ?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Nov 07, 2008 11:53 am     Reply with quote

Always post your compiler version number.

Most likely you have a problem in the hardware connection to the MMC/SD card. Expand your program to show the result of the mmcsd_flush_buffer() call, if this is unequal to zero you have a hardware problem.

There are at least two problems with the CCS mmcsd driver in v4.077.
Check out some hints in this thread
Guest








PostPosted: Tue Nov 11, 2008 11:15 am     Reply with quote

I use 4.057.
But I can't get result and simulate it with Proteus.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group