User manual
322
mikoC PRO for dsPIC
MikroElektronika
SignalPort = 0x03; // Notify that write has started
Delay_ms(1000);
for (i=0; i<=511; i++) // Write 512 bytes to sector 590
Cf_Write_Byte(i);
SignalPort = 0x07; // Notify that write end and read start
Delay_ms(1000);
Cf_Read_Init(590,1); // Initialize read from sector address 590
// for 1 sector
for (i=0; i<=511; i++) { // Read 512 bytes from sector address 590
SignalPort = Cf_Read_Byte(); // Read one byte at time and display
// readings on signal port
Delay_ms(5); // Wait for a while to see results
}
Delay_ms(1000);
///// Write numbers 511..0 to sector 590
Cf_Write_Init(590,1); // Initialize write at sector address 590
// for 1 sector
SignalPort = 0x03; // Notify that write has started
Delay_ms(1000);
for (i=0; i<=511; i++) // Write 512 bytes to sector 590
Cf_Write_Byte(511-i);
SignalPort = 0x07; // Notify that write end and read start
Delay_ms(1000);
Cf_Read_Init(590,1); // Initialize read from sector address 590
// for 1 sector
for (i=0; i<=511; i++) { // Read 512 bytes from sector address 590
SignalPort = Cf_Read_Byte(); // Read one byte at time and display
// readings on signal port
Delay_ms(5); // Wait for a while to see results
}
Delay_ms(1000);
}
// Main program
void main() {
ADPCFG = 0xFFFF; // disable A/D inputs
SignalPort_direction = 0; // designate PORTC as output
SignalPort = 0x01; // Notify test start
InitCF();
TestBytes();
SignalPort = 0x0F; // Notify test end
}