User manual
282
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
Cf_Init
Prototype
sub procedure Cf_Init()
Description Initializes ports appropriately for communication with CF card.
Parameters None.
Returns Nothing.
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_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 dened before using this function.
Example
‘ set compact ash pinout
dim Cf_Data_Port as byte at PORTD
dim CF_RDY as sbit at RB7_bit
dim CF_WE as sbit at LATB6_bit ‘ for writing to output pin always use latch
dim CF_OE as sbit at LATB5_bit ‘ for writing to output pin always use latch
dim CF_CD1 as sbit at RB4_bit
dim CF_CE1 as sbit at LATB3_bit ‘ for writing to output pin always use latch
dim CF_A2 as sbit at LATB2_bit ‘ for writing to output pin always use latch
dim CF_A1 as sbit at LATB1_bit ‘ for writing to output pin always use latch
dim CF_A0 as sbit at LATB0_bit ‘ for writing to output pin always use latch
dim CF_RDY_direction as sbit at TRISB7_bit
dim CF_WE_direction as sbit at TRISB6_bit
dim CF_OE_direction as sbit at TRISB5_bit
dim CF_CD1_direction as sbit at TRISB4_bit
dim CF_CE1_direction as sbit at TRISB3_bit
dim CF_A2_direction as sbit at TRISB2_bit
dim CF_A1_direction as sbit at TRISB1_bit
dim CF_A0_direction as sbit at TRISB0_bit
‘ end of cf pinout
‘Init CF
Cf_Init()
Notes None.