User manual
292
mikoPascal PRO for dsPIC30/33 and PIC24
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;
var
// set compact ash pinout
Cf_Data_Port : byte at PORTD;
CF_RDY : sbit at RB7_bit;
CF_WE : sbit at LATB6_bit; // for writing to output pin always use latch
CF_OE : sbit at LATB5_bit; // for writing to output pin always use latch
CF_CD1 : sbit at RB4_bit;
CF_CE1 : sbit at LATB3_bit; // for writing to output pin always use latch
CF_A2 : sbit at LATB2_bit; // for writing to output pin always use latch
CF_A1 : sbit at LATB1_bit; // for writing to output pin always use latch
CF_A0 : sbit at LATB0_bit; // for writing to output pin always use latch
CF_RDY_direction : sbit at TRISB7_bit;
CF_WE_direction : sbit at TRISB6_bit;
CF_OE_direction : sbit at TRISB5_bit;
CF_CD1_direction : sbit at TRISB4_bit;
CF_CE1_direction : sbit at TRISB3_bit;
CF_A2_direction : sbit at TRISB2_bit;
CF_A1_direction : sbit at TRISB1_bit;
CF_A0_direction : sbit at TRISB0_bit;
// end of cf pinout
const LINE_LEN = 37;
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;