Digital Control


Defines

#define STATUS_ON()   (STATUS_PORT|=STATUS_MASK)
#define STATUS_OFF()   (STATUS_PORT&=~STATUS_MASK)

Functions

int port_cfg (unsigned int channel, u8 data)
int Digital_out (u8 data, unsigned int channel)
u8 PLD_read_port (int port)
u8 read_port_cfg (unsigned int channel)
u8 Digital_in (unsigned int channel)
int Digital_Mask_Write (int data, u8 mask)
int Digital_Mask_Cfg (int cfg, u8 mask)
int Init_PLD_Holding (void)

Detailed Description

This module is the digital port driver. It provides functions to read,write and configure the digital ports of the IPAC. It also provides the macros for reading/writing to the PLD

Function Documentation

u8 Digital_in unsigned int  channel  ) 
 

read from a digital port.

This function reads one byte of data from a digital port. The data byte is a bytewise representation of the 8 pins of the port. This function essentialy just reads from the data registers of the respective ports.

Parameters:
channel the digital port to address, 0-5
See also:
port_cfg

int Digital_Mask_Cfg int  cfg,
u8  mask
 

Configure a mask of digital ports This command sends a configuration byte to a bitmask of the digital ports, from 0x0 for none to 0x1f for all of them. bit zero is port zero, bit one is port one, etc. setting the unused bits has no effect

Parameters:
cfg the configuration byte to write to the ports
mask the bitmask of the ports
Returns:
SUCCESS

int Digital_Mask_Write int  data,
u8  mask
 

Write to a mask of digital ports This command writes the same data to a bitmask of the digital ports, from 0x0 for none to 0x1f for all of them.

bit zero is port zero, bit one is port one, etc. setting the unused bits has no effect

Parameters:
data the byte to write to the ports
mask the bitmask of the ports
Returns:
SUCCESS

int Digital_out u8  data,
unsigned int  channel
 

Output data to a digital port.

This function sends one byte of data to a digital port. The data byte is a bytewise representation of the 8 pins of the port. Writing to pins configured as inputs will have no effect until their configuration is changed, at which point the written values will take effect. The function essentialy just writes to the data registers of the respective ports.

Parameters:
data the byte to send
channel the digital port to address, 0-5
See also:
port_cfg

int Init_PLD_Holding void   ) 
 

Initialize PLD holding registers Zeros the holding registers for the PLD output ports and resets the PLD outputs to zero. This is called by IpacInit and should not be called again

Returns:
SUCCESS
See also:
IpacInit

u8 PLD_read_port int  port  ) 
 

read from a digital port.

This function reads one byte of data from the IPAC PLD This function is called internally by the Digital_in function and is not intended to be called directly.

Parameters:
port the digital port to address, 0-5
See also:
port_cfg

int port_cfg unsigned int  channel,
u8  data
 

Configure to a digital port.

This function sends one byte of data to a digital ports configuration register. The data byte is a bytewise representation of the 8 pins of the port. 1's set port pins to be outputs and 0's to inputs.

Parameters:
data the configuration byte
channel the digital port to address, 0-5

u8 read_port_cfg unsigned int  channel  ) 
 

Configure to a digital port.

This function reads a digital ports configuration register. The data byte is a bytewise representation of the 8 pins of the port. 1's set port pins to be outputs and 0's to inputs.

Parameters:
channel the digital port to address, 0-5
See also:
port_cfg


Generated on Fri Mar 3 17:25:46 2006 for EMAC-HCS12-SDK by  doxygen 1.4.6