mxd2r.h File Reference

MXD2R Expansion Board Driver. More...


Defines

#define MXD2R_ADC_CHANNELS   3
#define MXD2R_OPTO_INPUTS   0
#define MXD2R_RELAYS   2
#define mxd2rSetRly1(value)   mxd2rSetRly(0, value)
#define mxd2rSetRly2(value)   mxd2rSetRly(1, value)

Functions

BYTE mxd2rAddEvents (void)
WORD mxd2rGetAdc (BYTE chan)
BYTE mxd2rGetIO (void)
BYTE mxd2rGetRly (void)
void mxd2rInit (void)
void mxd2rService (void)
void mxd2rSetIO (BYTE ch, BOOL bVal)
void mxd2rSetRly (BYTE rly, BOOL bVal)

Variables

WORD mxd2rAdcValues [MXD2R_ADC_CHANNELS]


Detailed Description

MXD2R 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 MXD2R 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.
 //*********************************************************************
 //-------------- MXD2R Configuration --------------------
 //*********************************************************************
 //Define ...
 //#define MXD2R_....

Define Documentation

#define MXD2R_ADC_CHANNELS   3

#define MXD2R_OPTO_INPUTS   0

#define MXD2R_RELAYS   2

#define mxd2rSetRly1 ( value   )     mxd2rSetRly(0, value)

Set or clear relay1.

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

#define mxd2rSetRly2 ( value   )     mxd2rSetRly(1, value)

Set or clear relay2.

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


Function Documentation

BYTE mxd2rAddEvents ( 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 mxd2rGetAdc ( 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 MXD2R
Returns:
Returns the 16 bit filtered ADC channel

BYTE mxd2rGetIO ( 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 mxd2rGetRly ( void   ) 

Gets the current state of both relays

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

void mxd2rInit ( void   ) 

Initialize the MXD2R module

void mxd2rService ( void   ) 

Service this module

void mxd2rSetIO ( 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 mxd2rSetRly ( 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 mxd2rAdcValues[MXD2R_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 mxd2rAdcValues[2]


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