User manual

280
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
Cf_Init
Prototype
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 dened before using this function.
Example
// set compact ash pinout
var
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 compact ash pinout
...
Cf_Init(); // initialize CF
Notes None.