It is currently 20 Jun 2019 17:14

All times are UTC + 1 hour

Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 31 Aug 2013 05:24 

Joined: 31 Aug 2013 05:09
Posts: 2
I"m working on a simple sd card project using mikroc's mmc library.
It will read CID register and display on Virtual terminal.
but mmc_init() doesn't work.
Anyone can help me?
I use pic18f452 with osc=20MHz.
MY schematic, hex file and mmc image file are included.
This is my code:

sbit Mmc_Chip_Select at LATC2_bit;
sbit Mmc_Chip_Select_Direction at TRISC2_bit;

char *text="SD CARD CID REGISTER";
void newline()
while (UART1_Tx_Idle()!=1){};
while (UART1_Tx_Idle()!=1){};
void main()
char message[16];
unsigned int error;
while (UART1_Tx_Idle()!=1){};
error= Mmc_Init();
if (error) UART1_Write_Text("failed");
else UART1_Write_Text("success");



SDcard.rar [39.82 KiB]
Downloaded 414 times
PostPosted: 02 Sep 2013 12:15 
User avatar

Joined: 18 Apr 2013 08:11
Posts: 2986

Did you try your project on real hardware or only in Proteus?
We usually recommend to our users to try their projects on real hardware.

Please, make sure that your card is properly formatted.
MMC/SD card has to be formatted to FAT16 file system.

Please, can you try MMC example from our compiler to see whether you have the same problem with that example:
...\mikroC PRO for PIC\Examples\Extra Boards\MMC\MMC Fat16

I can't see the schematic or MMC image file from the folder that you posted.

Best regards,

PostPosted: 04 Sep 2013 12:18 

Joined: 22 Aug 2011 07:13
Posts: 219
Proteus works fine with MikroC and the FAT Libraries. The issues are filesystems that Proteus works with on the host. My solution was writing a small routine that allowed me to call FAT32_Format first. That gave me an image file that could be used on other projects.

PostPosted: 07 Oct 2013 13:05 

Joined: 08 May 2013 18:31
Posts: 629
Location: Bangalore
What do you mean by not working. What should happen according to you code? I see there is a txt file inside the image file (.mmc file created using WinImage). The text inside the file is "This is File 1"

Do you want to write data received through UART to text file in the image file?

I have done SD card project using mikroC Compilers and it works fine in hardware and also Proteus. In Proteus you should not use the pullup resistors on the SPI lines with SD card.

To open .mmc file you have to rename it to .ima file and open it in WinImage.

New folder.rar [20.2 KiB]
Downloaded 522 times
sdcard.png [ 40.4 KiB | Viewed 3541 times ]

[HW:] EasyPIC v7, mikroProg PIC, AVR, STM32, PSoC, Tiva, 8051
[SW:] mikroC PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroBasic PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
mikroPascal PRO PIC, dsPIC, PIC32, AVR, ARM, 8051
Visual GLCD, Visual TFT
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour

Who is online

Users browsing this forum: No registered users and 2 guests

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 post attachments in this forum

Search for:
Jump to: