Analog and Digital I/O Functions


Detailed Description

Use these functions to read or write to digital I/O pins or read from analog input pins.


Data Structures

union  _int_union_
 INT FLAGS. More...
union  _io_flags_union
 IO FLAGS. More...

Typedefs

typedef union _int_union_ INT_FLAGS
typedef union _io_flags_union IO_FLAGS

Functions

NDICMDC_API BOOL NdiCmd_ReadDIO (int handle, int pin, BOOL *value)
 Read Digital Input.
NDICMDC_API BOOL NdiCmd_WriteDIO (int handle, int pin, BOOL value)
 Write Digital Output.
NDICMDC_API BOOL NdiCmd_ReadAIO (int handle, int pin, double *value)
 Read Analog Input.
NDICMDC_API BOOL NdiCmd_SetInterrupt (int handle, INT_FLAGS flags)
 Set Interrupt.
NDICMDC_API BOOL NdiCmd_GetInterruptStatus (int handle, INT_FLAGS *flags, WORD *io_lines)
 Get Interrupt Status.
NDICMDC_API BOOL NdiCmd_SetDIOMonitorInfo (int handle, int pin, IO_FLAGS flags)
 Set DIO Monitor Info.
NDICMDC_API BOOL NdiCmd_SetAIOMonitorInfo (int handle, int pin, IO_FLAGS flags, WORD lo, WORD hi)
 Set AIO Monitor Info.


Function Documentation

NDICMDC_API BOOL NdiCmd_GetInterruptStatus ( int  handle,
INT_FLAGS flags,
WORD *  io_lines 
)

Get Interrupt Status.

When the host determines that the interrupt line has been asserted, it should call this function to find out what caused the interrupt. It must then clear the interrupt by querying the state of the active source.

Parameters:
handle an integer WheelCommander handle
flags a pointer to an INT_FLAGS bitfield structure
io_lines a pointer to a WORD containing one bit per digital input in bits 0-7, and a bit for each analog input in bits 8-15.
Returns:
BOOL

NDICMDC_API BOOL NdiCmd_ReadAIO ( int  handle,
int  pin,
double *  value 
)

Read Analog Input.

Given the specified pin, this reads the analog voltage level by reading the 10 bit A/D converter value, then scaling that by 5.0 volts per 1024 values.

Parameters:
handle an integer WheelCommander handle
pin an integer specifying which analog input to read
value a pointer to a double returning the voltage
Returns:
BOOL

NDICMDC_API BOOL NdiCmd_ReadDIO ( int  handle,
int  pin,
BOOL *  value 
)

Read Digital Input.

Given the I/O pin number to read (0-7), this sets the specified pin to be a high-impedance input, then returns the current logic level of that pin at the BOOL pointed to by value.

Parameters:
handle an integer WheelCommander handle
pin an integer specifying which DIO pin to read
value a pointer to a BOOL, where the level is returned
Returns:
BOOL

NDICMDC_API BOOL NdiCmd_SetAIOMonitorInfo ( int  handle,
int  pin,
IO_FLAGS  flags,
WORD  lo,
WORD  hi 
)

Set AIO Monitor Info.

For the analog input 'pin', set up monitoring (or turn it off) based on the IO_FLAGS parameter flags and the lo and/or hi reference values. If watch_for_hi and watch_for_lo are both set in flags, then lo and hi can either specify a range outside of which an interrupt occurs (if lo < hi) or a range inside of which an interrupt occurs (if hi < lo). If only one of watch_for_lo or watch_for_hi is set, then this allows for a simple threshold test.

Parameters:
handle an integer WheelCommander handle
pin an integer indicating the digital input pin number (0-7)
flags an IO_FLAGS bitfield structure
lo a 10 bit analog input reference point (stored in a 16 bit WORD)
hi a 10 bit analog input reference point (stored in a 16 bit WORD)
Returns:
BOOL

NDICMDC_API BOOL NdiCmd_SetDIOMonitorInfo ( int  handle,
int  pin,
IO_FLAGS  flags 
)

Set DIO Monitor Info.

For the digital input 'pin', set up monitoring (or turn it off) based on the IO_FLAGS parameter flags. If watch_for_lo is set in flags, then an interrupt will occur when the input goes low; if watch_for_hi, when it goes high. If both are set, then any change causes an interrupt. None of this occurs if monitor is not set in flags, or if 'input' in flags is clear, or if 'digital' in flags is clear. If the flag called 'set' is high in the IO_FLAGS parameter passed, in, then the user interrupt will be immediately asserted.

Parameters:
handle an integer WheelCommander handle
pin an integer indicating the digital input pin number (0-7)
flags an IO_FLAGS bitfield structure
Returns:
BOOL

NDICMDC_API BOOL NdiCmd_SetInterrupt ( int  handle,
INT_FLAGS  flags 
)

Set Interrupt.

This provides a means to enable assertion of a specified digital output line, either as an active high or low signal, upon the occurance of certain conditions (motion operation complete; digital input at a certain state; analog input in a certain range). Digital and analog input monitoring is set using NdiCmd_SetDIOMonitorInfo() and NdiCmd_SetAIOMonitorInfo().

Parameters:
handle an integer WheelCommander handle
flags an INT_FLAGS bitfield structure
Returns:
BOOL

NDICMDC_API BOOL NdiCmd_WriteDIO ( int  handle,
int  pin,
BOOL  value 
)

Write Digital Output.

This sets the specified pin to be a digital output, then sets the logic level of the specified pin to value.

Parameters:
handle an integer WheelCommander handle
pin an integer specifying which DIO pin to write
value a BOOL setting the level of the pin
Returns:
BOOL


Generated on Mon Mar 2 17:01:02 2009 for Nubotics Device Interface DLL by  doxygen 1.5.5