Interfacing MMC Card with PIC Mircocontroller

Microcontroller Topics
Post Reply
User avatar
Magneto
Major
Major
Posts: 430
Joined: Wed Jul 15, 2009 1:52 pm
Location: London

Interfacing MMC Card with PIC Mircocontroller

Post by Magneto » Wed Feb 03, 2010 9:14 am

mmc.JPG
mmc.JPG (13 KiB) Viewed 3434 times
For applications where more storage is required I would definately reccomend MultiMediaCards (some times called SanDisk (SD) flash). The built in SPI interface only requires four data lines and they are available in sizes of up to 256MByte (at the moment). There are a few little quirks in making the cards work with a PIC but these are hopefully all sorted out within the code. The code is set to use the hardware SPI pins on the 16F876 and I haven't tried it any other way.

The MMC card has quite a large block size for writing, I think at the moment it is at least 512Bytes although I think I saw something about a new version of the specifcation that is more flexible. But at the moment this means that you need to buffer 512Bytes and write them all in one go, the eeprom code (above) is ideal for this. The write_block function just writes the lowest 512Bytes from the eeprom to the MMC. The same is true when reading the card and in my current application I only need to read the data to a PC so the read_block function just outputs every byte to RS232 although it wouldn't be hard to insert some processing or pass each byte to whatever function you wanted. This is just the functions you need to get some code working and then drop these in.

Source Code
PIC_CCS_C_MMC_card.zip
(1.81 KiB) Downloaded 712 times
Post Reply

Return to “Microcontrollers”