Code: Select all
unsigned i;
char size;
void initcf(){
Cf_Init(&PORTB,&PORTD);
while(Cf_Detect()==0)
{
LCD_Out(1,1, "Insert CF");
}
LCD_Out(1,1, "CF Inserted");
Delay_ms(2000);
}
void filew (){
i = 0;
Delay_ms(1000);
Cf_Write_Init(590, 1);
for (i = 0; i < 512; i++) {
Cf_Write_Byte(i + 33); }
Lcd_Cmd(Lcd_CLEAR);
i=0;
LCD_Out(1,1, "Start READ");
Delay_ms(1000);
Cf_Read_Init(590, 1);
for (i = 0; i < 512; i++) {
size = Cf_Read_Byte();
LCD_Out(1,1, size);
Delay_ms(500);
}
}
When I wait for the read command it returns some garbage and them the program freeze. Some ideas? I verify the hardware dozen thimes and it's correct.