Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] Mmc_Fat_init () problem in Proteus

Status
Not open for further replies.

Tareq Domi

Junior Member level 2
Junior Member level 2
Joined
Nov 16, 2014
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
167
hello guys !

i need to interface an SD/MMC card with PIC 18F4520 , just to read/write a text file .
well , i wrote a simple code on Mikroc as a start , but i faced a problem once i use "Mmc_fat_init() " .

here is the code :
Code:
sfr sbit Mmc_Chip_Select at RC0_bit;
sfr sbit Mmc_Chip_Select_Direction at TRISC0_bit;

void main() {
      
      SPI1_Init();
     
      SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
       
          error = MMC_Init();
 while(error == 1)
 {
  error = MMC_Init();
 }

 //MMc_Fat_Init() ;
   

       
}

this code is working correctly on proteus , but once i uncomment the line " //MMc_Fat_init() ; " then the initialization fails in the proteus .

anyone can give a help
thanks
 

Have you disabled ADC and other multiplexed function on RC0 and other pins used for MMC SD Card communication ? Post your complete mikroC project files. Zip and post your Proteus file. Have you created an .mmc file to load into MMC model of Proteus using winImage 8.9 ?
 
well , here is my full project attached

in my program you will find LINE #70 commented , once you uncomment that line then every thing goes oddly !!

also , i have a couple of images i think it will make sense for you :

Screenshot_1.jpgScreenshot_2.jpgScreenshot_3.jpgScreenshot_4.jpg

so what do you think the problem is ?
thanks
 

Attachments

  • mmc_project.rar
    133 KB · Views: 94

It works. I have renamed the .IMA file to .mmc for use with Proteus. I have imported your Proteus 7.x file to 8.1 format. Load the .mmc file to SD Card model and simulate.
 

Attachments

  • mmc_project.rar
    199.9 KB · Views: 78
how it works !!!!!

i have already renamed the .IMA file into .mmc file !!
same problem !!

i tried your hex file with the proteus file and it works !!!
what does that men !!!?

- - - Updated - - -

well , as for the attached file you gave me , it seems there is one justification .
i think the problem is on the compiler itself , it seems am using a compiler with some limits on libraries .

to check if that is true , could you please compile the attached .c file and give me the hex file .
if it works then the problem is related to my compiler .

thanks .
 

Attachments

  • testcompiler.rar
    984 bytes · Views: 79

I have made some changes to the code. I have made TRISx, PORTx, LATx initializations and have used LATx for LCD abit defines. For PIC18F you have to write to LATx registers to output data. I am using mikroC PRO PIC 6.4.0. Make a copy of attached project and compile it and see if there is any difference between my .hex file and yours.

111443d1416237162-sdcard.png
 

Attachments

  • test.rar
    185.3 KB · Views: 83
  • sdcard.png
    sdcard.png
    41 KB · Views: 116
your attached .hex file works with me , and the result is same as the image you attached .

i compiled the attached test.c file and tested the .hex file ,,, same problem again !

so it is a compiler issue .
thanks alot
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top