The Godfather talking
This is god damn my place! Capisci?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 10:45:37 22:45


Login with username, password and session length


Pages: [1]
Print
Author Topic: MMC card problem with 18F8722. please help me :(  (Read 11837 times)
0 Members and 1 Guest are viewing this topic.
thenorthstar
Newbie
*
Offline Offline

Posts: 9

Thank You
-Given: 2
-Receive: 0


« on: May 03, 2010, 08:59:18 08:59 »

Hi My friends.I apologize for my bad english first. my name is mustafa, Im from turkey.I need help for the MMC card project.Can you help me?
I'am edit the Mcro c code and runing on proteus file but I can not run when the circuit made. I do not know where I'm wrong. Please help me.Thank you vaey mach

http://rapidshare.com/files/382950311/MMC.rar


« Last Edit: May 03, 2010, 12:06:42 12:06 by thenorthstar » Logged
thenorthstar
Newbie
*
Offline Offline

Posts: 9

Thank You
-Given: 2
-Receive: 0


« Reply #1 on: May 03, 2010, 03:07:37 15:07 »

Please help me.
What is the problem this project.
Logged
bbarney
Moderator
Hero Member
*****
Offline Offline

Posts: 2430

Thank You
-Given: 405
-Receive: 545


Uhm? where did pickit put my mute button


« Reply #2 on: May 03, 2010, 04:46:47 16:46 »

you don't say what the problem is , only that it does not work
What part does not work ,is the pic running ? or you only get gibberish on the screen ?
be a little more clear on what is happening when your trying to run it
Logged

Ever wonder why Kamikaze pilot's wore helmet's ?
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #3 on: May 03, 2010, 06:36:08 18:36 »

thenorthstar,

Your program runs just good as what you are writing for. Its just keep APPEND to a file, READ the ADC, WRITE to a file and delay for one second.

You don’t give your circuit and your program any other option; just reads ADC write to the file, delay and then repeat. Here is your loop:

            for(;Wink                      // sonsuz döngu
            {
            Rj2_bit  = 0;                // Turn ON LEDs on PORTJ
            mmc_fat_append();            //dosyanın sonuna ilave et
            sicakligi_oku();             //sicaklığı oku
            mmc_fat_write(sicaklik,9);   // sd karta yaz
            Rj2_bit  = 1;                // Turn ON LEDs on PORTJ
            UART1_Write_Line("TEMPERATURE DATA STORAGE");
            delay_ms(1000);              // 1 sn bekle
            }

I suggest:

You make a  continues loop and keep monitoring some input and response to the input. Let say you will have two input buttons, one for write and the other for read.

While(1)
{
   if(!button_1)   // USE ANY PORT PIN FOR INPUT1
   {
            Rj2_bit  = 0;                // Turn ON LEDs on PORTJ
            mmc_fat_append();            //dosyanın sonuna ilave et
            sicakligi_oku();             //sicaklığı oku
            mmc_fat_write(sicaklik,9);   // sd karta yaz
            Rj2_bit  = 1;                // Turn ON LEDs on PORTJ
            UART1_Write_Line("TEMPERATURE DATA STORAGE");
            delay_ms(100);              // 1 sn bekle
   }

   if(!button_2)    // USE ANY PORT PIN FOR INPUT2
   {
      --- DO THE READING AND DISPLAY ON LCD OR THE TERMINAL ---
      (Of course you need to prepare file name and read cmd)
   }      
}

Try to modify your circuit and program to see how it works.

Good luck,


Tom
Logged

Con Rong Chau Tien
thenorthstar
Newbie
*
Offline Offline

Posts: 9

Thank You
-Given: 2
-Receive: 0


« Reply #4 on: May 04, 2010, 07:17:23 07:17 »

bbarney,

you don't say what the problem is , only that it does not work
What part does not work ,is the pic running ? or you only get gibberish on the screen ?
be a little more clear on what is happening when your trying to run it
I have a problem , this program is works on proteus and write tempareture in sıcaklık.mmc but I can not run when the circuit made on pcb.
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


« Reply #5 on: May 04, 2010, 11:57:53 11:57 »

you don't say what the problem is , only that it does not work
What part does not work ,is the pic running ? or you only get gibberish on the screen ?
be a little more clear on what is happening when your trying to run it
well what can I add,
1. do you know if micro is running?  is led flashing? (xtal, config, wiring error)
2. any display on screen?                 is display Blank, Dots or what ever?
3. have you checked pic config is right?

Have you coded a board check program?

When I start a new project I program test code to test Display(hello world), Leds(flash leds at a timed rate) and Input devices(switch on leds via input pins)
And when board is working then go-on to project.
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
thenorthstar
Newbie
*
Offline Offline

Posts: 9

Thank You
-Given: 2
-Receive: 0


« Reply #6 on: May 05, 2010, 06:55:46 06:55 »

thenorthstar,

Your program runs just good as what you are writing for. Its just keep APPEND to a file, READ the ADC, WRITE to a file and delay for one second.

You don’t give your circuit and your program any other option; just reads ADC write to the file, delay and then repeat. Here is your loop:

            for(;Wink                      // sonsuz döngu
            {
            Rj2_bit  = 0;                // Turn ON LEDs on PORTJ
            mmc_fat_append();            //dosyanın sonuna ilave et
            sicakligi_oku();             //sicaklığı oku
            mmc_fat_write(sicaklik,9);   // sd karta yaz
            Rj2_bit  = 1;                // Turn ON LEDs on PORTJ
            UART1_Write_Line("TEMPERATURE DATA STORAGE");
            delay_ms(1000);              // 1 sn bekle
            }

I suggest:

You make a  continues loop and keep monitoring some input and response to the input. Let say you will have two input buttons, one for write and the other for read.

While(1)
{
   if(!button_1)   // USE ANY PORT PIN FOR INPUT1
   {
            Rj2_bit  = 0;                // Turn ON LEDs on PORTJ
            mmc_fat_append();            //dosyanın sonuna ilave et
            sicakligi_oku();             //sicaklığı oku
            mmc_fat_write(sicaklik,9);   // sd karta yaz
            Rj2_bit  = 1;                // Turn ON LEDs on PORTJ
            UART1_Write_Line("TEMPERATURE DATA STORAGE");
            delay_ms(100);              // 1 sn bekle
   }

   if(!button_2)    // USE ANY PORT PIN FOR INPUT2
   {
      --- DO THE READING AND DISPLAY ON LCD OR THE TERMINAL ---
      (Of course you need to prepare file name and read cmd)
   }      
}

Try to modify your circuit and program to see how it works.

Good luck,


Tom


TomJackson69;

I tried your suggestion but it did not work the same. I would also try running proteus but not works on my board.
I made a mistake in my code, I do not know.





Code:
// MMC module connections
sbit Mmc_Chip_Select           at LATD2_bit;  // for writing to output pin always use latch (PIC18 family)
sbit Mmc_Chip_Select_Direction at TRISD2_bit;
// eof MMC module connections

           char filename[]="SICAKLIKTXT";
           unsigned char ch1,ch2;
           unsigned char sicaklik[10];
           char    mmc_error;
          unsigned char k;
           //
           // analog port AN0'dan sicaklığı oku
           //
          void sicakligi_oku()
           {
             unsigned long Vin,Vdec,Vfrac,Vfac;
             unsigned char op[12];
             unsigned char i,j;


             vin= adc_read(0);        // an0'dan sicaklığı oku
             vin=488*vin;            // scale up the result
             vin=vin/10;             // sicaklığı santigrata dönüştür
             vdec=vin/100;           //tam sayi bölümü
             vfrac=vin%100;          // kesirli bölümü
             longTostr(vdec,op);    // sicaklık "op" karakter dizisinde

             //
             //
             //

             j= 0   ;
             for (i=0;i<=11;i++)
             {
             if (op[i]!=' ')
             {
             sicaklik [j]=op[i];
             j++;
             }
            }

            //
            // sıcaklığın nn.m sekline koy ve sonuna yeni satır ilave et
            //

            sicaklik[j]='.';             // "." ilave et
            ch1=vfrac/10;                // ksirli bölüm
            ch2=vfac%10;
            j++;
            sicaklik[j]=48+ch1 ;          // ascı karaktere dönüştür
            j++;
            sicaklik[j]=48+ch2  ;         // ascı karaktere dönüştür
            j++;
            sicaklik[j]=0x0d;            //yeni satırın başına git
            j++;
            sicaklik[j]=0x0a;            // yeni satıra ilave et
            j++;
            sicaklik[j]='\0';
            }

            //
            // ana program başlangıcı
            //
// UART1 write text and new line (carriage return + line feed)
void UART1_Write_Line(char *uart_text) {
  UART1_Write_Text(uart_text);
  UART1_Write(13);
  UART1_Write(10);
}


void main()
            {
            trisa=0xff;
            adcon1=0x80;          // a/d cevirici an0,vref = +5v
            TRISJ = 0;           // set direction to be output
            TRISB1_bit = 1;      // set RB1 pin as input
            TRISD3_bit = 0;      // set RD3 pin as input
            //
            // sd karti spı moduna koy
            //
  for (k=0;k<=3;k++)
             {
  Rj2_bit  = 0;      // Turn ON LEDs on PORTJ
  delay_ms(100);              // wait 1 second
  Rj2_bit  = 1;      // Turn ON LEDs on PORTJ
  delay_ms(100);
            }

  // Initialize UART1 module
  UART1_Init(19200);
  Delay_ms(100);
  UART1_Write_Line("READY"); // PIC present report
  UART1_Write(13);



// Initialize SPI2 module
  SPI2_Init_Advanced(_SPI_MASTER_OSC_DIV16, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_LOW_2_HIGH);

     // sd karti baslat
    // initialise a MMC card
  mmc_error = Mmc_Init();
  Rj2_bit  = 0;                // Turn ON LEDs on PORTJ
  delay_ms(500);              // 1 sn bekle
  if(mmc_error == 0)
   UART1_Write_Line("MMC OK"); // If MMC present report
  else
    UART1_Write_Line("NOT INSERTED MMC"); // If error report

// sd kart üzerinde SICAKLIK.TXT isimli bir dosya yarat

UART1_Write_Line("CREATING SICAKLIK.TXT FILE");
Mmc_Fat_Assign(&filename, 0xA0);             // Find existing file or create a new one
UART1_Write_Line("CREATE FILE");
Mmc_Fat_Rewrite();                          // To clear file and start with new data
UART1_Write_Line("FILE OPENED FOR WRITE");
Rj2_bit  = 1;                // Turn ON LEDs on PORTJ
mmc_fat_write("TEMPERATURE DATA STORAGE PER SECOND \r\n",41);

            //
            // sicaklığı her saniye oku,santigrata dönüştür ve sd karta yaz
            //
      UART1_Write_Line("4");
        RD3_bit  = 1;
     
     
     // do {
         while (1)
         {
              if (Button(&PORTB, 1, 2, 0)) {  // write Button
            RD3_bit  = 0;
            Rj2_bit  = 0;                // Turn ON LEDs on PORTJ
            mmc_fat_append();            //dosyany'n sonuna ilave et
            sicakligi_oku();             //Read tempareture
            mmc_fat_write(sicaklik,9);   // write in MMC card
            Rj2_bit  = 1;                // Turn ON LEDs on PORTJ
            UART1_Write_Line("TEMPERATURE DATA STORAGE");
            delay_ms(100);              // wait 1 ms
             }

        } //while (1);

            }
Logged
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #7 on: May 06, 2010, 03:15:22 03:15 »

thenorthstar,

First I have to tell you that I don't have MikroC installed in my computer, and, I have not used MicKoC; so I can not write the program for you. I will help you with what I know (I am using MPLAB C18, C30 and C32).

I see you have implement one part of my suggestion that is the write button. I would like you to use READ button for reading the file and display the data on the terminal (use UART1_Write_Line()Wink.


   if(!button_2)    // USE ANY PORT PIN FOR INPUT2
   {
      --- DO THE READING AND DISPLAY ON LCD OR THE TERMINAL ---
      (Of course you need to prepare file name and read cmd)
      (you may have to close the open file and then reopen for read)
   }     



One of the thing I see is a problem when you define FILENAME:

char filename[]="SICAKLIKTXT";

I think you are using FAT16 and the filename is SHORT filename that is in the format of 8.3. You should change the filename to:

char filename[]="SICAKLIK.TXT";   // see the period

After change the filename, compile your file to see if it works.

I have a question for you:

How do you know if it is works or not? Do you read the MMC card by card reader?

As I said, you should use the READ BUTTON to read the file and display the data on the LCD or Hyperterminal. That way, you know if it is write the data to the MMC card.

Until then, I will check back later.

Regards,

Tom


« Last Edit: May 06, 2010, 03:20:47 03:20 by TomJackson69 » Logged

Con Rong Chau Tien
bbarney
Moderator
Hero Member
*****
Offline Offline

Posts: 2430

Thank You
-Given: 405
-Receive: 545


Uhm? where did pickit put my mute button


« Reply #8 on: May 06, 2010, 06:47:43 06:47 »

And this maybe a dumb question but You did format the mmc card didn't you ?
Logged

Ever wonder why Kamikaze pilot's wore helmet's ?
thenorthstar
Newbie
*
Offline Offline

Posts: 9

Thank You
-Given: 2
-Receive: 0


« Reply #9 on: May 06, 2010, 09:13:17 09:13 »

bbarney,
yes brother threw mmc card format but still did not work.Sad

Posted on: May 06, 2010, 09:53:41 09:53 - Automerged

TomJackson69,

First I thank my brother and I 'm sorry for my english.
I read the MMC card by card reader but  When I look into the MMC card is empty.
I tried your suggestion, yes I'm using FAT16 and changed the filename to: char filename[]="SICAKLIK.TXT"; and I tried again but still did not work.

my brother, I ask, can you  write sample cod (read and write file in mmc card same my project) whit MPLAB C18  for me? Sad
Logged
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #10 on: May 06, 2010, 03:59:03 15:59 »

thenorthstar,

Try to close the openned file before you read it.

Change your while loop to a for loop to write 10 ADC samples enthen close the file:

        while (1)
         {
              if (Button(&PORTB, 1, 2, 0)) {  // write Button
            RD3_bit  = 0;
            Rj2_bit  = 0;                // Turn ON LEDs on PORTJ
            mmc_fat_append();            //dosyany'n sonuna ilave et
            sicakligi_oku();             //Read tempareture
            mmc_fat_write(sicaklik,9);   // write in MMC card
            Rj2_bit  = 1;                // Turn ON LEDs on PORTJ
            UART1_Write_Line("TEMPERATURE DATA STORAGE");
            delay_ms(100);              // wait 1 ms
             }

        } //while (1);

change to:

        for(i = 0; i <= 10; i++)
         {
              //if (Button(&PORTB, 1, 2, 0))
             //{  // write Button
                  RD3_bit  = 0;
                  Rj2_bit  = 0;                        // Turn ON LEDs on PORTJ
                  mmc_fat_append();             //dosyany'n sonuna ilave et
                  sicakligi_oku();                    //Read tempareture
                  mmc_fat_write(sicaklik,9);   // write in MMC card
                  Rj2_bit  = 1;                        // Turn ON LEDs on PORTJ
                 UART1_Write_Line("TEMPERATURE DATA STORAGE");
                 delay_ms(300);                    // wait 300 ms so you can see the LED blink
            // }
        }

After write 10 sample, close the file.

//===========================//

thenorthstar,

For writting an example for you -->> the answer is NO <<--. It is not good for you because you will not learn. On the other hand, this is your project, you should spend lot of time to research and practice so you can learn from it. I can point you to the right direction so that you can complete your project.

And here is a link to the example from MikroC:

http://www.mikroe.com/eng/product_downloads/download/

Download the "BIGPIC5 mikroC Examples [147.74KB] ", you will se one example for the MMC. In fact, below is the copy:

/*
 * Project name:
     MMC_FAT16_Test (Demonstration on usage of MMC_FAT16 library)
 * Copyright:
     (c) MikroElektronika, 2005-2008
 * Description:
     This project consists of several blocks that demonstrat various aspects of
     usage of the MMC_FAT16 library. These are:
     - Creation of new file and writing down to it;
     - Opening existing file and re-writing it (writing from start-of-file);
     - Opening existing file and appending data to it (writing from end-of-file);
     - Opening a file and reading data from it (sending it to USART terminal);
     - Creating and modifying several files at once;
 * Test configuration:
     MCU:             PIC18F8520
     Dev.Board:       BIGPIC5
     Oscillator:      HS, 10.000 MHz
     Ext. Modules:    MMC/SD card
     SW:              mikroC v.8.1
 * NOTES:
     - Please make sure that MMC card is properly formatted (to FAT16 or just FAT)
       before testing it on this example!
     - The MMC uses hardware SPI for communication, so make sure that it gets
       properly connected to the port where SPI module is located (PORTC for most
       PICs)!
     - This library is for PIC18 MCUs only!
 */

#include <built_in.h>

char
 fat_txt[20] = "FAT16 not found",
 file_contents[50] = "XX MMC/SD FAT16 library by Anton Rieckert\n";

char
 filename[14] = "MIKRO00xTXT";          // File names
unsigned short
 tmp, caracter, loop, loop2;
unsigned long
 i, size;
 
char Buffer[512];


// writes string to USART
void I_Write_Str(char *ostr) {
  unsigned short i;

  i = 0;
  while (ostr) {
    USART_Write(ostr[i++]);
  }
  USART_Write(0x0A);
}

// creates new file and writes some data to it
void M_Create_New_File() {
  filename[7] = 'A';                    // set filename for single-file tests
  Mmc_Fat_Assign(&filename, 0xA0);      // will not find file and then create file
  Mmc_Fat_Rewrite();                    // to clear file and start with new data
  for(loop = 1; loop <= 99; loop++) {   // we want 5 files on the MMC card
    Usart_Write('.');
    file_contents[0] = loop / 10 + 48;
    file_contents[1] = loop % 10 + 48;
    Mmc_Fat_Write(file_contents, 42);   // write data to the assigned file
  }
}

// creates many new files and writes data to them
void M_Create_Multiple_Files() {
  for(loop2 = 'B'; loop2 <= 'Z'; loop2++) {
    Usart_Write(loop2);                 // signal the progress
    filename[7] = loop2;                // set filename
    Mmc_Fat_Assign(&filename, 0xA0);    // find existing file or create a new one
    Mmc_Fat_Rewrite();                  // to clear file and start with new data
    for(loop = 1; loop <= 44; loop++) {
      file_contents[0] = loop / 10 + 48;
      file_contents[1] = loop % 10 + 48;
      Mmc_Fat_Write(file_contents, 42);  // write data to the assigned file
    }
  }
}

// opens an existing file and rewrites it
void M_Open_File_Rewrite() {
  filename[7] = 'C';
  Mmc_Fat_Assign(&filename, 0);
  Mmc_Fat_Rewrite();
  for(loop = 1; loop <= 55; loop++) {
    file_contents[0] = loop / 10 + 64;
    file_contents[1] = loop % 10 + 64;
    Mmc_Fat_Write(file_contents, 42);    // write data to the assigned file
  }
}//~

// Opens an existing file and appends data to it
//   (and alters the date/time stamp)
void M_Open_File_Append() {
     filename[7] = 'B';
     Mmc_Fat_Assign(&filename, 0);
     Mmc_Fat_Set_File_Date(2005,6,21,10,35,0);
     Mmc_Fat_Append();                                    // prepare file for append
     Mmc_Fat_Write(" for mikroElektronika 2005\n", 27);   // write data to assigned file
}

// opens an existing file, reads data from it and puts it to USART
void M_Open_File_Read() {
  filename[7] = 'B';
  Mmc_Fat_Assign(&filename, 0);
  Mmc_Fat_Reset(&size);            // to read file, procedure returns size of file
  for (i = 1; i <= size; i++) {
    Mmc_Fat_Read(&caracter);
    Usart_Write(caracter);         // write data to USART
  }
}//~

// deletes a file. if file doesn't exist, it will first be created
//   and then deleted.
void M_Delete_File() {
  filename[7] = 'F';
  Mmc_Fat_Assign(filename, 0);
  Mmc_Fat_Delete();
}//~

// tests whether file exists, and if so sends its creation date
//   and file size via USART
void M_Test_File_Exist() {
  unsigned long fsize;
  unsigned int year;
  unsigned short month, day, hour, minute;
  unsigned char outstr[12];

  filename[7] = 'B';
  //  filename[7] = 'F';   // uncomment this line to search for file that DOES NOT exist
  if (Mmc_Fat_Assign(filename, 0)) {
    //  file has been found - get its date
    Mmc_Fat_Get_File_Date(&year, &month, &day, &hour, &minute);
    WordToStr(year, outstr);
    I_Write_Str(outstr);
    ByteToStr(month, outstr);
    I_Write_Str(outstr);
    WordToStr(day, outstr);
    I_Write_Str(outstr);
    WordToStr(hour, outstr);
    I_Write_Str(outstr);
    WordToStr(minute, outstr);
    I_Write_Str(outstr);
    // get file size
    fsize = Mmc_Fat_Get_File_Size();
    LongToStr((signed long)fsize, outstr);
    I_Write_Str(outstr);
  }
  else {
    // file was not found - signal it
    Usart_Write(0x55);
    Delay_ms(1000);
    Usart_Write(0x55);
  }
}

// tries to create a swap file, whose size will be at least 100
//   sectors (see Help for details)
void M_Create_Swap_File() {
  unsigned int i;

  for(i=0; i<512; i++)
    Buffer = i;

  size = Mmc_Fat_Get_Swap_File(5000, "mikroE.txt", 0x20);   // see help on this function for details

  if (size) {
    LongToStr((signed long)size, fat_txt);
    I_Write_Str(fat_txt);

    for(i=0; i<5000; i++) {
      Mmc_Write_Sector(size++, Buffer);
      Usart_Write('.');
    }
  }
}

// main. uncomment the function(s) to test the desired operation(s)
void main() {
     // prepare PORTB for signalling
     CMCON |= 0x07;                          // turn off comparators
     ADCON1 |= 0x0F;                         // turn off analog inputs
     MEMCON.EBDIS = 1;                       // disable external memory bus

     PORTB = 0;
     TRISB = 0;
     TRISD = 0;
     // set up USART for the file read
     Usart_Init(19200);
     Delay_100ms();
     // init the FAT library
     Spi_Init_Advanced(MASTER_OSC_DIV64, DATA_SAMPLE_MIDDLE, CLK_IDLE_LOW, LOW_2_HIGH);
     // use fat16 quick format instead of init routine if a formatting is needed
     if (!Mmc_Fat_Init(&PORTE, 0)) {
         // reinitialize spi at higher speed
         Spi_Init_Advanced(MASTER_OSC_DIV4, DATA_SAMPLE_MIDDLE, CLK_IDLE_LOW, LOW_2_HIGH);
         // test start
         PORTB = 0xF0;
         // test routines. uncomment them one-by-one to test certain features
         M_Create_New_File();
         M_Create_Multiple_Files();
         M_Open_File_Rewrite();
         M_Open_File_Append();
         M_Open_File_Read();
         M_Delete_File();
         M_Test_File_Exist();
         M_Create_Swap_File();
         // signal end-of-test
         Usart_Write('e');
     }
     else {
       I_Write_Str(fat_txt);
     }
     // test termination
     PORTB = 0x0F;
}

Don't try to find the short cut to learn, you will forget very quickly.

I suggest you to use this example and experiment with all the option until it works.

***--- remember in this example the 10MHz crystal is used ---***

Also, when you initialize the MMC with:

Spi_Init_Advanced(MASTER_OSC_DIV64, DATA_SAMPLE_MIDDLE, CLK_IDLE_LOW, LOW_2_HIGH);

Pay attention to the "MASTER_OSC_DIV64" --->>> this is for 10MHz (you use 20MHz)

and where is your buffer? I see in the example hey used: char Buffer[512]; (I think the sector is 512 bytes). When write, I think you need to specify which sector to write to (may be in MikroC is different).

Here is an importance note from MikroC:
"
   - Please make sure that MMC card is properly formatted (to FAT16 or just FAT)
       before testing it on this example
!

    - The MMC uses hardware SPI for communication, so make sure that it gets
       properly connected to the port where SPI module is located (PORTC for most
       PICs)!
"
Good luck,

Tom


« Last Edit: May 06, 2010, 06:18:06 18:18 by TomJackson69 » Logged

Con Rong Chau Tien
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #11 on: May 07, 2010, 12:43:35 00:43 »

thenorthstar,

After take a closer look at the example program, I found I have make a mistake when I suggested you to change the file name from "SICAKLIKTXT" to "SICAKLIK.TXT". Please change it back to your original filename. In C18, the file name use "8.3" format. Sorry for that.

Anyways, the example program from MikroC should work.

Regards,

Tom 
Logged

Con Rong Chau Tien
thenorthstar
Newbie
*
Offline Offline

Posts: 9

Thank You
-Given: 2
-Receive: 0


« Reply #12 on: May 07, 2010, 07:09:20 07:09 »

thanks my brother. I try this.
Logged
smainj
Active Member
***
Offline Offline

Posts: 125

Thank You
-Given: 70
-Receive: 75



WWW
« Reply #13 on: May 09, 2010, 04:53:15 16:53 »

you can use M25P128   -   128Mbit Serial Flash Memory With 50MHz Interface
is more easy
Logged

gabriel
Active Member
***
Offline Offline

Posts: 134

Thank You
-Given: 283
-Receive: 59


« Reply #14 on: June 17, 2010, 06:23:41 18:23 »

hello:
I'm trying a similar project, and I like to simulate it first with proteus. the problem is that I don't know how to get a formatted image for the MMC, I used winhex to create an empty raw 32MB MMC image file (named cardimage.mmc), but how to get it formatted, I didn't found such a option in winhex.
I'm really stuck, please help.

thanks in advance
Logged
TomJackson69
Active Member
***
Offline Offline

Posts: 218

Thank You
-Given: 26
-Receive: 63


« Reply #15 on: June 18, 2010, 07:01:52 19:01 »

garbriel,

Go to "C:\Program Files\Labcenter Electronics\Proteus 7 Professional\SAMPLES\VSM for USB\PICDEM FS USB\MSD" copy the "disk.bin" to your project folder and use it as the disk image for your MMC card.

Tom
Logged

Con Rong Chau Tien
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC