ior5e.h File Reference

IOR5E Expansion Board Driver. More...


Data Structures

union  _IOR5E

Defines

#define IOR5E_ADC_CHANNELS   5
#define IOR5E_I1   PORTA_RA0
#define IOR5E_I2   PORTA_RA1
#define IOR5E_I3   PORTA_RA2
#define IOR5E_I4   PORTA_RA3
#define IOR5E_I5   PORTA_RA5
#define IOR5E_I6   PORTA_RA4
#define IOR5E_IO1_DIR   TRISA_RA0
#define IOR5E_IO2_DIR   TRISA_RA1
#define IOR5E_IO3_DIR   TRISA_RA2
#define IOR5E_IO4_DIR   TRISA_RA3
#define IOR5E_IO5_DIR   TRISA_RA5
#define IOR5E_IO6_DIR   TRISA_RA4
#define IOR5E_O1   LATA0
#define IOR5E_O2   LATA1
#define IOR5E_O3   LATA2
#define IOR5E_O4   LATA3
#define IOR5E_O5   LATA5
#define IOR5E_O6   LATA4
#define IOR5E_OPTO_INPUTS   4
#define IOR5E_RELAYS   5
#define ior5eSetRly1(value)   ior5eSetRly(0, value)
#define ior5eSetRly2(value)   ior5eSetRly(1, value)
#define ior5eSetRly3(value)   ior5eSetRly(2, value)
#define ior5eSetRly4(value)   ior5eSetRly(3, value)
#define ior5eSetRly5(value)   ior5eSetRly(4, value)

Functions

BYTE ior5eAddEvents (void)
WORD ior5eGetAdc (BYTE chan)
BYTE ior5eGetIO (void)
BYTE ior5eGetOpto (void)
BYTE ior5eGetRly (void)
void ior5eInit (void)
void ior5eService (void)
void ior5eSetIO (BYTE ch, BOOL bVal)
void ior5eSetRly (BYTE rly, BOOL bVal)

Variables

WORD ior5eAdcValues [IOR5E_ADC_CHANNELS]
union _IOR5E ior5eLatchData
union _IOR5E ior5eLatchDataOld


Detailed Description

IOR5E Expansion Board Driver.

Author:
Modtronix Engineering
Dependencies:
Compiler:
MPLAB C18 v2.10 or higher
HITECH PICC-18 V8.35PL3 or higher

Description

This module implements a driver for the IOR5E Input/Output/Relay board. To use this module:

Configuration

The following defines are used to configure this module, and should be placed in the projdefs.h (or similar) file. For details, see Project Configuration. To configure the module, the required defines should be uncommended, and the rest commented out.
 //*********************************************************************
 //-------------- IOR5E Configuration --------------------
 //*********************************************************************
 //Define ...
 //#define IOR5E_....

Define Documentation

#define IOR5E_ADC_CHANNELS   5

#define IOR5E_I1   PORTA_RA0

#define IOR5E_I2   PORTA_RA1

#define IOR5E_I3   PORTA_RA2

#define IOR5E_I4   PORTA_RA3

#define IOR5E_I5   PORTA_RA5

#define IOR5E_I6   PORTA_RA4

#define IOR5E_IO1_DIR   TRISA_RA0

#define IOR5E_IO2_DIR   TRISA_RA1

#define IOR5E_IO3_DIR   TRISA_RA2

#define IOR5E_IO4_DIR   TRISA_RA3

#define IOR5E_IO5_DIR   TRISA_RA5

#define IOR5E_IO6_DIR   TRISA_RA4

#define IOR5E_O1   LATA0

#define IOR5E_O2   LATA1

#define IOR5E_O3   LATA2

#define IOR5E_O4   LATA3

#define IOR5E_O5   LATA5

#define IOR5E_O6   LATA4

#define IOR5E_OPTO_INPUTS   4

#define IOR5E_RELAYS   5

#define ior5eSetRly1 ( value   )     ior5eSetRly(0, value)

Set or clear relay1.

Parameters:
value When 0, relay 1 is switched of. When 1, relay 1 is switched on

#define ior5eSetRly2 ( value   )     ior5eSetRly(1, value)

Set or clear relay2.

Parameters:
value When 0, relay 2 is switched of. When 1, relay 2 is switched on

#define ior5eSetRly3 ( value   )     ior5eSetRly(2, value)

Set or clear relay3.

Parameters:
value When 0, relay 3 is switched of. When 1, relay 3 is switched on

#define ior5eSetRly4 ( value   )     ior5eSetRly(3, value)

Set or clear relay4.

Parameters:
value When 0, relay 4 is switched of. When 1, relay 4 is switched on

#define ior5eSetRly5 ( value   )     ior5eSetRly(4, value)

Set or clear relay5.

Parameters:
value When 0, relay 5 is switched of. When 1, relay 5 is switched on


Function Documentation

BYTE ior5eAddEvents ( void   ) 

Check if any events occured, and add them to all active event ports.

Returns:
Returns byte indicating what event ports had data added to them. Use EVT_BUF_XX defines

WORD ior5eGetAdc ( BYTE  chan  ) 

Gets the requested 16 bit filtered ADC channel.

Parameters:
chan The channel to get, a value from 1 to 5 for channels 1 to 5 of IOR5E
Returns:
Returns the 16 bit filtered ADC channel

BYTE ior5eGetIO ( void   ) 

Gets the current state of all 6 IOs

Returns:
The IO values in bit 0-5. Bit 0 indicates state of IO 1, bit 1 indicated the state of IO2 2, ....

BYTE ior5eGetOpto ( void   ) 

Get all 4 opto coupler inputs values

Returns:
The Opto Coupler values in bit 0-3

BYTE ior5eGetRly ( void   ) 

Gets the current state of all 5 relays

Returns:
The relay values in bit 0-4. Bit 0 indicates state of relay 1, bit 1 indicated the state of relay 2, ....

void ior5eInit ( void   ) 

Initialize the IOR5E module

void ior5eService ( void   ) 

Service this module

void ior5eSetIO ( BYTE  ch,
BOOL  bVal 
)

Set or clear given IO port. Is only done if this IO port is current set as an ouput

Parameters:
ch Offset of IO to perform action on. A value from 0-n. IO1 will be 0, IO2 will be 1, ....
bVal When 0, relay is switched of. When 1, relay is switched on

void ior5eSetRly ( BYTE  rly,
BOOL  bVal 
)

Set or clear given relay

Parameters:
rly Offset of relay to perform action on. A value from 0-n. Relay 1 will be 0, relay 2 will be 1, ....
bVal When 0, relay is switched of. When 1, relay is switched on


Variable Documentation

WORD ior5eAdcValues[IOR5E_ADC_CHANNELS]

Global Array containing converted ADC values. This array can be accessed from anywhere to obtain the current value of the ADC inputs. For example, to get the current value of AN2 ADC, use ior5eAdcValues[2]


Generated on Wed Feb 3 12:45:34 2010 for SBC65EC Web Server by  doxygen 1.5.8