I/O Pin Handling

Functions related to handling I/O pins. More...

Functions

canStatus kvIoGetNumberOfPins (const int hnd, unsigned int *pinCount)
 
canStatus kvIoConfirmConfig (const int hnd)
 
canStatus kvIoPinGetInfo (const int hnd, unsigned int pin, int item, void *buffer, const unsigned int bufsize)
 
canStatus kvIoPinSetInfo (const int hnd, unsigned int pin, int item, const void *buffer, const unsigned int bufsize)
 
canStatus kvIoPinSetDigital (const int hnd, unsigned int pin, unsigned int value)
 
canStatus kvIoPinGetDigital (const int hnd, unsigned int pin, unsigned int *value)
 
canStatus kvIoPinGetOutputDigital (const int hnd, unsigned int pin, unsigned int *value)
 
canStatus kvIoPinSetRelay (const int hnd, unsigned int pin, unsigned int value)
 
canStatus kvIoPinGetOutputRelay (const int hnd, unsigned int pin, unsigned int *value)
 
canStatus kvIoPinSetAnalog (const int hnd, unsigned int pin, float value)
 
canStatus kvIoPinGetAnalog (const int hnd, unsigned int pin, float *value)
 
canStatus kvIoPinGetOutputAnalog (const int hnd, unsigned int pin, float *value)
 
canStatus kvIoGetModulePins (const int hnd, unsigned int module, void *buffer, const unsigned int bufsize)
 
canStatus kvIoSetModulePins (const int hnd, unsigned int module, const void *buffer, const unsigned int bufsize)
 

Detailed Description

Functions related to handling I/O pins.

The kvIoXxx functions are used for configuring and controlling I/O pins on I/O modules connected to a device.

I/O functions use a pin number to access each pin on connected I/O modules. Pin enumeration is product dependent.

It is required to verify the configuration before it is possible to use any kvIoPinSetXxx()/kvIoPinGetXxx() function. The module configuration can be examined with kvIoGetNumberOfPins() and kvIoPinGetInfo(). If the configuration is as expected, a call to kvIoConfirmConfig() will confirm the configuration. Removing or adding I/O modules will change the configuration and the pins are re-enumerated. It is always required to confirm the new configuration after a configuration change.

Function Documentation

◆ kvIoConfirmConfig()

canStatus kvIoConfirmConfig ( const int  hnd)
C#
static Canlib.kvStatus kvIoConfirmConfig(CanHandle handle);
Delphi
function kvIoConfirmConfig(hnd: canHandle): canStatus;

This function is used to confirm configuration. It is required to call this function, before it is possible to use any kvIoPinSetXxx()/kvIoPinGetXxx() function. After a configuration change, module removal or insertion, it is required to confirm the new configuration.

Parameters
[in]hndAn open handle to a CAN channel.
See also
I/O Pin Handling
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoGetModulePins()

canStatus kvIoGetModulePins ( const int  hnd,
unsigned int  module,
void *  buffer,
const unsigned int  bufsize 
)
C#
static Canlib.canStatus kvIoGetModulePins(int hnd, int module, object buffer);
Delphi
function kvIoGetModulePins(hnd: canHandle; module: cardinal; var buffer; bufsize: cardinal): canStatus;

This function is used to read all the pins on one module in a single call.

Parameters
[in]hndAn open handle to a CAN channel.
[in]moduleThe module number, see kvIO_INFO_GET_MODULE_NUMBER.
[out]bufferA pointer to a struct that receives the pin values of the module. The struct can be any one of the following depending on the module. The returned type is described in the first byte of the returned struct. See:
[in]bufsizeThe size of the struct pointed to by buffer
See also
kvIoSetModulePins()
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoGetNumberOfPins()

canStatus kvIoGetNumberOfPins ( const int  hnd,
unsigned int *  pinCount 
)
C#
static Canlib.kvStatus kvIoGetNumberOfPins(CanHandle handle, out Int32 pinCount);
Delphi
function kvIoGetNumberOfPins(hnd: canHandle; var pinCount: cardinal): canStatus;

Get the number of I/O pins available from a device.

Parameters
[in]hndAn open handle to a CAN channel.
[out]pinCountA pointer to an int which receives the number of pins.
Returns
canOK (zero) if success
canERR_xxx (negative) if failure
See also
kvIoPinGetInfo(), I/O Pin Handling
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinGetAnalog()

canStatus kvIoPinGetAnalog ( const int  hnd,
unsigned int  pin,
float *  value 
)
C#
static Canlib.kvStatus kvIoPinGetAnalog(CanHandle handle, Int32 pin, out float value);
Delphi
function kvIoPinGetAnalog(hnd: canHandle; pin: cardinal; var value: single): canStatus;

This function is used to retrieve the voltage level of the specified analog I/O pin.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[out]valueA pointer to a float which receives the voltage of the pin.
See also
kvIoPinSetAnalog()
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinGetDigital()

canStatus kvIoPinGetDigital ( const int  hnd,
unsigned int  pin,
unsigned int *  value 
)
C#
static Canlib.kvStatus kvIoPinGetDigital(CanHandle handle, Int32 pin, out Int32 value);
Delphi
function kvIoPinGetDigital(hnd: canHandle; pin: cardinal; var value: cardinal): canStatus;

This function is used to retrieve the value of the specified digital input I/O pin. If the pin is LOW, the integer pointed to by value is assigned zero. If the pin is HIGH, the integer pointed to by value is assigned a '1'.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[out]valueA pointer to an unsigned int which receives the value of the pin.
See also
kvIoPinSetDigital()
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinGetInfo()

canStatus kvIoPinGetInfo ( const int  hnd,
unsigned int  pin,
int  item,
void *  buffer,
const unsigned int  bufsize 
)
C#
static Canlib.kvStatus kvIoPinGetInfo(CanHandle handle, Int32 pin, kvIOGetInfo item, ref Object data);
Delphi
function kvIoPinGetInfo(hnd: canHandle; pin: cardinal; item: Integer; var buffer; bufsize: cardinal): canStatus;

This function is used to retrieve I/O pin properties.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[in]itemType of item to retrieve kvIO_INFO_GET_xxx.
[out]bufferThe address of a buffer which is to receive the data.
[in]bufsizeThe size of the buffer, matching the size of selected kvIO_INFO_GET_xxx item.
See also
kvIoPinSetInfo(), I/O Pin Handling
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinGetOutputAnalog()

canStatus kvIoPinGetOutputAnalog ( const int  hnd,
unsigned int  pin,
float *  value 
)
C#
static Canlib.kvStatus kvIoPinGetOutputAnalog(CanHandle handle, Int32 pin, out float value);
Delphi
function kvIoPinGetOutputAnalog(hnd: canHandle; pin: cardinal; var value: single): canStatus;

This function is used to get the latest set voltage level of an analog I/O pin. This function only returns values as they are presented in memory and the actual value on the output pin may therefore differ.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[out]valueA pointer to a float which receives the latest set voltage level of the pin.
See also
kvIoPinSetAnalog()
Note
The actual voltage level on the output pin may differ.
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinGetOutputDigital()

canStatus kvIoPinGetOutputDigital ( const int  hnd,
unsigned int  pin,
unsigned int *  value 
)
C#
static Canlib.kvStatus kvIoPinGetOutputDigital(CanHandle handle, Int32 pin, out Int32 value);
Delphi
function kvIoPinGetOutputDigital(hnd: canHandle; pin: cardinal; var value: cardinal): canStatus;

This function is used to get the latest set value of a digital output I/O pin. If the latest value written to the pin is LOW, the integer pointed to by value is assigned zero. If it is HIGH, the integer pointed to by value is assigned a '1'. This function only returns values as they are presented in memory and the actual value on the output pin may therefore differ.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[out]valueA pointer to an unsigned int which receives the latest set value of the pin.
See also
kvIoPinSetDigital()
Note
The actual value on the output pin may differ.
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinGetOutputRelay()

canStatus kvIoPinGetOutputRelay ( const int  hnd,
unsigned int  pin,
unsigned int *  value 
)
C#
static Canlib.kvStatus kvIoPinGetOutputRelay(CanHandle handle, Int32 pin, out Int32 value);
Delphi
function kvIoPinGetOutputRelay(hnd: canHandle; pin: cardinal; var value: cardinal): canStatus;

This function is used to get the latest set value of a relay I/O pin. If value is zero, the relay has been set to OFF. For any non-zero value, the relay has been set to ON. This function returns values as they are presented in memory and the actual state on the relay pin may differ.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[in]valueA pointer to an unsigned int which receives the latest set value of the pin.
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinSetAnalog()

canStatus kvIoPinSetAnalog ( const int  hnd,
unsigned int  pin,
float  value 
)
C#
static Canlib.kvStatus kvIoPinSetAnalog(CanHandle handle, Int32 pin, float value);
Delphi
function kvIoPinSetAnalog(hnd: canHandle; pin: cardinal; value: single): canStatus;

This function is used to set the voltage level of the specified analog I/O pin.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[in]valueA float which sets a voltage of the pin.
See also
kvIoPinGetAnalog()
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinSetDigital()

canStatus kvIoPinSetDigital ( const int  hnd,
unsigned int  pin,
unsigned int  value 
)
C#
static Canlib.kvStatus kvIoPinSetDigital(CanHandle handle, Int32 pin, Int32 value);
Delphi
function kvIoPinSetDigital(hnd: canHandle; pin: cardinal; value: cardinal): canStatus;

This function is used to set a digital output I/O pin. If value is zero, the pin is set LOW. For any non-zero value, the pin is set HIGH.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[in]valueAn unsigned int which sets a value of the pin.
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinSetInfo()

canStatus kvIoPinSetInfo ( const int  hnd,
unsigned int  pin,
int  item,
const void *  buffer,
const unsigned int  bufsize 
)
C#
static Canlib.kvStatus kvIoPinSetInfo(CanHandle handle, Int32 pin, kvIOSetInfo item, Object data);
Delphi
function kvIoPinSetInfo(hnd: canHandle; pin: cardinal; item: Integer; var buffer; bufsize: cardinal): canStatus;

This function is used to set I/O pin properties, for items that can be changed.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[in]itemType of item to set, see kvIO_INFO_SET_xxx.
[in]bufferThe address of a buffer contains the data to set.
[in]bufsizeThe size of the buffer, matching the size of selected kvIO_INFO_SET_xxx item.
See also
kvIoPinGetInfo()
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoPinSetRelay()

canStatus kvIoPinSetRelay ( const int  hnd,
unsigned int  pin,
unsigned int  value 
)
C#
static Canlib.kvStatus kvIoPinSetRelay(CanHandle handle, Int32 pin, Int32 value);
Delphi
function kvIoPinSetRelay(hnd: canHandle; pin: cardinal; value: cardinal): canStatus;

This function is used to control a relay of the specified I/O pin. If value is zero, the relay is set to OFF. For any non-zero value, the relay is set to ON.

Parameters
[in]hndAn open handle to a CAN channel.
[in]pinThe pin number, see kvIoGetNumberOfPins.
[in]valueAn unsigned int which sets a value of the pin.
Note
Preliminary API that may change.
Not implemented in Linux.

◆ kvIoSetModulePins()

canStatus kvIoSetModulePins ( const int  hnd,
unsigned int  module,
const void *  buffer,
const unsigned int  bufsize 
)
C#
static Canlib.canStatus kvIoSetModulePins(int hnd, int module, object buffer);
Delphi
function kvIoSetModulePins(hnd: canHandle; module: cardinal; var buffer; bufsize: cardinal): canStatus;

This function is used to set all the pins on one single module in a single call.

Parameters
[in]hndAn open handle to a CAN channel.
[in]moduleThe module number, see kvIO_INFO_GET_MODULE_NUMBER.
[out]bufferA pointer to a struct that contains the module type and pin values to set. The struct can be any one of the following depending on the module.
[in]bufsizeThe size of the struct pointed to by buffer
See also
kvIoGetModulePins()
Note
Note The input Pins are ignored.
Preliminary API that may change.
Not implemented in Linux.