User manual

272
mikoPascal PRO for PIC32
MikroElektronika
Library Example
This project consists of several blocks that demonstrate various aspects of usage of the Cf_Fat16 library. These are :
- Creation of new le and writing down to it;
- Opening existing le and re-writing it (writing from start-of-le);
- Opening existing le and appending data to it (writing from end-of-le);
- Opening a le and reading data from it (sending it to USART terminal);
- Creating and modifying several les at once;
- Reading le contents;
- Deleting le(s);
- Creating the swap le (see Help for details);
Copy Code To Clipboard
program CF_Fat16_Test;
// set compact ash pinout
var
Cf_Data_Port : byte at PORTE;
CF_RDY : sbit at RD7_bit;
CF_WE : sbit at LATD6_bit;
CF_OE : sbit at LATD5_bit;
CF_CD1 : sbit at RD4_bit;
CF_CE1 : sbit at LATD3_bit;
CF_A2 : sbit at LATD2_bit;
CF_A1 : sbit at LATD1_bit;
CF_A0 : sbit at LATD0_bit;
CF_RDY_direction : sbit at TRISD7_bit;
CF_WE_direction : sbit at TRISD6_bit;
CF_OE_direction : sbit at TRISD5_bit;
CF_CD1_direction : sbit at TRISD4_bit;
CF_CE1_direction : sbit at TRISD3_bit;
CF_A2_direction : sbit at TRISD2_bit;
CF_A1_direction : sbit at TRISD1_bit;
CF_A0_direction : sbit at TRISD0_bit;
// end of compact ash pinout
const LINE_LEN = 39;
var
err_txt : string[20];
le_contents : string[LINE_LEN];
lename : string[14]; // File names
character : byte;
loop, loop2 : byte;
i, size : longint;
Buffer : array[512] of byte;
// UART write text and new line (carriage return + line feed)
procedure UART1_Write_Line( var uart_text : string );