![]() |
Functions related to handling I/O pins. More...
Functions | |
canStatus | kvIoGetNumberOfPins (const CanHandle hnd, unsigned int *pinCount) |
canStatus | kvIoConfirmConfig (const CanHandle hnd) |
canStatus | kvIoPinGetInfo (const CanHandle hnd, unsigned int pin, int item, void *buffer, const unsigned int bufsize) |
canStatus | kvIoPinSetInfo (const CanHandle hnd, unsigned int pin, int item, const void *buffer, const unsigned int bufsize) |
canStatus | kvIoPinSetDigital (const CanHandle hnd, unsigned int pin, unsigned int value) |
canStatus | kvIoPinGetDigital (const CanHandle hnd, unsigned int pin, unsigned int *value) |
canStatus | kvIoPinGetOutputDigital (const CanHandle hnd, unsigned int pin, unsigned int *value) |
canStatus | kvIoPinSetRelay (const CanHandle hnd, unsigned int pin, unsigned int value) |
canStatus | kvIoPinGetOutputRelay (const CanHandle hnd, unsigned int pin, unsigned int *value) |
canStatus | kvIoPinSetAnalog (const CanHandle hnd, unsigned int pin, float value) |
canStatus | kvIoPinGetAnalog (const CanHandle hnd, unsigned int pin, float *value) |
canStatus | kvIoPinGetOutputAnalog (const CanHandle hnd, unsigned int pin, float *value) |
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.
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.
[in] | hnd | An open handle to a CAN channel. |
Get the number of I/O pins available from a device.
[in] | hnd | An open handle to a CAN channel. |
[out] | pinCount | A pointer to an int which receives the number of pins. |
This function is used to retrieve the voltage level of the specified analog I/O pin.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[out] | value | A pointer to a float which receives the voltage of the pin. |
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'.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[out] | value | A pointer to an unsigned int which receives the value of the pin. |
canStatus kvIoPinGetInfo | ( | const CanHandle | hnd, |
unsigned int | pin, | ||
int | item, | ||
void * | buffer, | ||
const unsigned int | bufsize | ||
) |
This function is used to retrieve I/O pin properties.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[in] | item | Type of item to retrieve kvIO_INFO_GET_xxx. |
[out] | buffer | The address of a buffer which is to receive the data. |
[in] | bufsize | The size of the buffer, matching the size of selected kvIO_INFO_GET_xxx item. |
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.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[out] | value | A pointer to a float which receives the latest set voltage level of the pin. |
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.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[out] | value | A pointer to an unsigned int which receives the latest set value of the pin. |
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.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[in] | value | A pointer to an unsigned int which receives the latest set value of the pin. |
This function is used to set the voltage level of the specified analog I/O pin.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[in] | value | A float which sets a voltage of the pin. |
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.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[in] | value | An unsigned int which sets a value of the pin. |
canStatus kvIoPinSetInfo | ( | const CanHandle | hnd, |
unsigned int | pin, | ||
int | item, | ||
const void * | buffer, | ||
const unsigned int | bufsize | ||
) |
This function is used to set I/O pin properties, for items that can be changed.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[in] | item | Type of item to set, see kvIO_INFO_SET_xxx. |
[in] | buffer | The address of a buffer contains the data to set. |
[in] | bufsize | The size of the buffer, matching the size of selected kvIO_INFO_SET_xxx item. |
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.
[in] | hnd | An open handle to a CAN channel. |
[in] | pin | The pin number, see kvIoGetNumberOfPins. |
[in] | value | An unsigned int which sets a value of the pin. |