Mikroelektronika MIKROE-350 データシート

ページ / 526
Cf_Init
192
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure Cf_Init()
Returns
Nothing.
Description
Initializes ports appropriately for communication with CF card.
Requires
Global variables : 
CF_Data_Port
: Compact Flash data port 
CF_RDY
: Ready signal line 
CF_WE
: Write enable signal line 
CF_OE
: Output enable signal line 
CF_CD1
: Chip detect signal line 
CF_CE1
: Enable signal line 
CF_A2
: Address pin 2 
CF_A1
: Address pin 1 
CF_A0
: Address pin 0 
CF_Data_Port_direction
: Direction of the Compact Flash data direction port 
CF_RDY_direction
: Direction of the Ready pin 
CF_WE_direction
: Direction of the Write enable pin 
CF_OE_direction
: Direction of the Output enable pin 
CF_CD1_direction
: Direction of the Chip detect pin 
CF_CE1_direction
: Direction of the Chip enable pin 
CF_A2_direction
: Direction of the Address 2 pin 
CF_A1_direction
: Direction of the Address 1 pin 
CF_A0_direction
: Direction of the Address 0 pin 
must be defined before using this function.
Example
' set compact flash pinout 
dim CF_Data_Port as byte at PORTD
dim Cf_Data_Port_Direction as byte at DDRD
dim CF_RDY as sbit at PINB.B7
dim CF_WE  as sbit at PORTB.B6
dim CF_OE  as sbit at PORTB.B5
dim CF_CD1 as sbit at PINB.B4
dim CF_CE1 as sbit at PORTB.B3
dim CF_A2  as sbit at PORTB.B2
dim CF_A1  as sbit at PORTB.B1
dim CF_A0  as sbit at PORTB.B0
dim CF_RDY_direction as sbit at DDRB.B7
dim CF_WE_direction  as sbit at DDRB.B6
dim CF_OE_direction  as sbit at DDRB.B5
dim CF_CD1_direction as sbit at DDRB.B4
dim CF_CE1_direction as sbit at DDRB.B3
dim CF_A2_direction  as sbit at DDRB.B2
dim CF_A1_direction  as sbit at DDRB.B1
dim CF_A0_direction  as sbit at DDRB.B0
' end of cf pinout
'Init CF
Cf_Init()