Datasheet

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
dim
' set compact flash pinout
Cf_Data_Port as byte at PORTD
Cf_Data_Port_Direction as byte at DDRD
CF_RDY as sbit at PINB.B7
CF_WE as sbit at PORTB.B6
CF_OE as sbit at PORTB.B5
CF_CD1 as sbit at PINB.B4
CF_CE1 as sbit at PORTB.B3
CF_A2 as sbit at PORTB.B2
CF_A1 as sbit at PORTB.B1
CF_A0 as sbit at PORTB.B0
CF_RDY_direction as sbit at DDRB.B7
CF_WE_direction as sbit at DDRB.B6
CF_OE_direction as sbit at DDRB.B5
CF_CD1_direction as sbit at DDRB.B4
CF_CE1_direction as sbit at DDRB.B3
CF_A2_direction as sbit at DDRB.B2
CF_A1_direction as sbit at DDRB.B1
CF_A0_direction as sbit at DDRB.B0
' end of cf pinout
FAT_TXT as string[20]
file_contents as string[50]
filename as string[14] ' File names
character as byte
loop_, loop2 as byte
size as longint
Buffer as byte[512]
'-------------- Writes string to USART
sub procedure Write_Str(dim byref ostr as byte[2] )
dim
i as byte
205
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6