You are here

ADC Module SW Interface

GPIO-24 analog-to-digital converter is easy to setup and use. You can enable/disable the ADC module and select the analog reference voltage. You can request the analog input values at any time. Besides, ADC module may send the analog input values periodically or when user-defined limits are reached.

Use GPIO_SET_ADC_MODULE_CFG command to configure the ADC module of USB-I/O adapter. You can enable/disable the ADC module with this command. When you enable the ADC module, all the 5 pins (C.1, C.2, C.5, C.6 and B.3) are switched to analog input mode.

You can specify the analog reference voltage in Byte 3. Bit 0: VREF_HI and Bit 1: VREF_LOW of this byte are used to configure VRefHi and VRefLow, respectively. The upper reference voltage (VRefHi) can be either the GPIO-24 adapter positive supply voltage (VDD) or the voltage on the C.6 pin. VRefLow can be either negative supply voltage (VSS) or the voltage level on the C.5 pin.

Use GPIO_SET_ADC_CHANNEL_CFG command to set the conditions of event generation. You may specify the low threshold value in Bytes 4..5: LOW_LSB/LOW_MSB and the high threshold value in Bytes 6..7: HIGH_LSB/HIGH_MSB. These limits are constantly compared with input voltage. The event can be sent when input voltage reaches user-defined limits, depending on the condition of comparison (Bits 7..4: EVENT_CONDITION of Byte 2).

USB-I/O adapter may send events periodically with predefined interval. The repeat interval is specified in Byte 3: REPEAT in units of 10 ms.

For more detailed information about the event see Section 7.4, “ADC Event”.

By default, the ADC channels settings (configured with GPIO_SET_ADC_CHANNEL_CFG command) are saved in USB-I/O adapter memory. When you switch off the ADC module, the C.1, C.2, C.5, C.6 and B.3 pins cease to be analog inputs, but the ADC channels configuration is retained. To reset the pins configurations, specify 1 in Byte 4: RESET_CHANNELS of GPIO_SET_ADC_MODULE_CFG command. After reset the default values are applied to all ADC channels.

With GPIO_GET_ADC_VAL command you can get the current analog input values. Send GPIO_GET_ADC_CHANNEL_CFG command to retrieve the conditions of event generation. ADC module configuration can be retrieved with GPIO_GET_ADC_MODULE_CFG command.