Some Kvaser products feature I/O pins that can be used in real-time applications using our API dedicated to I/O Pin Handling. This API is initialized by confirming the I/O pin configuration, see kvIoConfirmConfig. Before the configuration is confirmed the user can only retrieve information about the pins, such as the total number of pins using kvIoGetNumberOfPins, and after the configuration has been confirmed the user may set or read any values of the I/O pins.
Pins are identified by their pin number, which is a number from zero up to, but not including, the value returned by kvIoGetNumberOfPins(). Using the pin number the specific properties of any pin is retrieved using kvIoPinGetInfo and modified using kvIoPinSetInfo. See kvIO_INFO_GET_xxx and kvIO_INFO_SET_xxx to learn what properties can be read and modified.
There are currently three types of pins that is supported by our API dedicated to I/O Pin Handling. These include analog, digital and relay pins. To learn what pin type a given pin is, the argument kvIO_INFO_GET_PIN_TYPE is used when calling kvIoPinGetInfo. See kvIO_PIN_TYPE_xxx to see what type each value represents.
The analog pins are represented by multiple bits, the number of bits can be retrieved by using kvIoPinGetInfo with kvIO_INFO_GET_NUMBER_OF_BITS as an argument. The value of an analog pin is within in the interval given by kvIO_INFO_GET_RANGE_MIN and kvIO_INFO_GET_RANGE_MAX. The analog input pin has two configurable properties, namely the low pass filter order and the hysteresis. See kvIO_INFO_SET_AI_LP_FILTER_ORDER and kvIO_INFO_SET_AI_HYSTERESIS to learn about these properties. Pins are read and set using kvIoPinSetAnalog and kvIoPinGetAnalog respectively. To read the latest set output of an output pin the function kvIoPinGetOutputAnalog is used.
The digital pins have two configurable properties, namely the low-to-high and the high-to-low filter time. See kvIO_INFO_SET_DI_HIGH_LOW_FILTER and kvIO_INFO_SET_DI_LOW_HIGH_FILTER to learn about these properties. Pins are read and set using kvIoPinSetDigital and kvIoPinGetDigital respectively. To read the latest set output of an output pin the function kvIoPinGetOutputDigital is used.
The relay pins have no configurable properties. All of these pins are considered as outputs. Pins are set using kvIoPinSetRelay and the status of them, whether they are activated or not, is read using kvIoPinGetOutputRelay.