mikroC
making it simple...
Library Example
The following example writes 512 bytes at sector no.590, and then reads the data and prints on
PORTC for a visual check.
unsigned i;
void main() {
TRISC = 0;
Cf_Init(PORTB, PORTD);
do nop;
while (!Cf_Detect());
Delay_ms(500);
Cf_Write_Init(590, 1);
// Write 512 bytes to sector (590)
for (i = 0; i < 512; i++) Cf_Write_Byte(i + 11);
PORTC = 0xFF;
Delay_ms(1000);
Cf_Read_Init(590, 1);
// Read 512 bytes from sector (590)
for (i = 0; i < 512; i++) {
PORTC = Cf_Read_Byte();
Delay_ms(1000);
}
}
MikroElektronika: Development tools - Books - Compilers
mikroC - C Compiler for Microchip PIC microcontrollers
// PORTC is output
// Initialize ports
// Wait until CF card is inserted
// Initialize write at sector address 590
// Initialize read at sector address 590
// Read byte and display on PORTC
page
169
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?