dxtr
Member level 3
Hey everyone
i know this question has been posted several times , i read all the other topics but i didn't get the right answer yet
well i want to interface my micro sd with pic 18f2550 , i format it with FAT 16 and i used the code in the mmc help section
here is my code :
i even try with MMC_INIT() with no result
can u please guide me to the problem ?
i know this question has been posted several times , i read all the other topics but i didn't get the right answer yet
well i want to interface my micro sd with pic 18f2550 , i format it with FAT 16 and i used the code in the mmc help section
here is my code :
Code:
// MMC module connections
sbit Mmc_Chip_Select at LATC0_bit; // for writing to output pin always use latch (PIC18 family)
sbit Mmc_Chip_Select_Direction at TRISC0_bit;
// eof MMC module connections
int i;
void main() {
ADCON1 |= 0x0F; // Configure AN pins as digital
CMCON |= 7; // Turn off comparators
trisa = 0x00;
// Initialize SPI1 module
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
while (1)
{
i = Mmc_Fat_Init();
switch (i)
{
case 0 : porta = 0b00000001; break;
case 1 : porta = 0b00000010; break;
case 255 : porta = 0b00000011; break;
default: porta = 0xff; break;
}
delay_ms(50);
}
}}
can u please guide me to the problem ?