Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Library Example
The following example is a simple demonstration of CF(Compact Flash) Library
which shows how to use CF card data accessing routines. 
program CF_Fat16_Test;
var
// set compact flash pinout
Cf_Data_Port : byte 
at PORTD;
Cf_Data_Port_Direction : byte  
at DDRD;
CF_RDY : 
sbit at PINB.B7;
CF_WE  : 
sbit at PORTB.B6;
CF_OE  : 
sbit at PORTB.B5;
CF_CD1 : 
sbit at PINB.B4;
CF_CE1 : 
sbit at PORTB.B3;
CF_A2  : 
sbit at PORTB.B2;
CF_A1  : 
sbit at PORTB.B1;
CF_A0  : 
sbit at PORTB.B0;
CF_RDY_direction : 
sbit at DDRB.B7;
CF_WE_direction  : 
sbit at DDRB.B6;
CF_OE_direction  : 
sbit at DDRB.B5;
CF_CD1_direction : 
sbit at DDRB.B4;
CF_CE1_direction : 
sbit at DDRB.B3;
CF_A2_direction  : 
sbit at DDRB.B2;
CF_A1_direction  : 
sbit at DDRB.B1;
CF_A0_direction  : 
sbit at DDRB.B0;
// end of cf pinout
FAT_TXT : 
string[20];
file_contents : 
string[50];
filename : 
string[14];   // File names
character : byte;
loop, loop2 : byte;
size : longint;
Buffer : 
array[512] of byte;
//-------------- Writes string to USART
procedure Write_Str(var ostr: array[2] of byte);
var
i : byte;
begin 
i := 0;
220
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6