The GPIO_SET_ADC_MODULE_CFG command switches on/off the ADC module of GPIO-24 adapter and configures the reference voltage.
| Byte 0 | GPIO_SET_ADC_MODULE_CFG | Command ID (must be 0x20). | |
| Byte 1 | ECHO | Echo to associate a command with the response. | |
| Byte 2 | ON | ADC module state (on/off) | |
| Byte 3 | Bits 7..2 | Reserved | Reserved (must be 0). |
| Bit 1 | VREF_LOW | Low reference voltage configuration. | |
| Bit 0 | VREF_HI | High reference voltage configuration. | |
| Byte 4 | RESET_CHANNELS | ADC channels Reset byte | |
| Bytes 5..7 | Reserved | Reserved (must be 0) | |
Command is an 8-byte array of the following format:
This byte contains command ID (command type). It must be set to 0x20.
This byte is used to associate a response received from GPIO-24 adapter with a specific command. Response will contain exactly the same value in its echo byte.
The ADC module state (on/off):
1 – turn on the ADC module. The C.1, C.2, C.5, C.6 and B.3 pins become analog inputs (ADC channels). GPIO_GET_CFG and GPIO_GET_PIN_CFG commands will return GPIO_CFG_ADC (0x4) value for the pins. The pins can be used only by the ADC module;
0 – turn off the ADC module. The ADC mode will be switched off on the C.1, C.2, C.5, C.6 and B.3 pins. GPIO_GET_CFG and GPIO_GET_PIN_CFG commands will return GPIO_CFG_NOT_CONFIGURED (0xf) value for the pins. The pins can be used by any module.
This byte contains reference voltage configuration. You can use either
USB-I/O adapter supply voltage
(VDD and VSS) or the
external reference voltage connected to C.6
(VRefHi) and C.5
(VRefLow) pins:
These bits are reserved for future usage and must be set to 0.
The low reference voltage:
1 – the external voltage reference on C.5 pin is used as low reference voltage;
0 – the USB-I/O adapter
negative supply voltage
(VSS) is used as low
reference voltage.
The high reference voltage:
1 – the external voltage reference on C.6 pin is used as high reference voltage;
0 – the USB-I/O adapter
positive supply voltage
(VDD) is used as high
reference voltage.
If you use the external reference voltage, the following requirements must be met:
(VRefHi – VRefLow) ≥ 3V
VSS < VRefHi < VDD
(VSS – 0.3V) < VRefLow < (VDD – 3.0V)
Impedance of the reference voltage source must be less then 2.5k
The ADC channels Reset byte:
1 – the ADC channels settings (configured with GPIO_SET_ADC_CHANNEL_CFG command) will be reset. The default values will be applied to all ADC channels;
0 – the ADC channels settings (configured with GPIO_SET_ADC_CHANNEL_CFG command and saved in
USB-I/O adapter memory) will not be
reset.
These bytes are reserved for future and must be set to 0.
For convenience GPIO_SET_ADC_MODULE_CFG_CMD structure is declared in reports.h file.
GPIO-24 adapter sends GPIO_SET_ADC_MODULE_CFG response after command execution.
| Byte 0 | GPIO_SET_ADC_MODULE_CFG | Response ID (0x20). |
| Byte 1 | ECHO | Echo to associate a command with the response. |
| Byte 2 | ST | Command execution status. |
| Bytes 3..7 | Reserved | Reserved |
Response is an 8-byte array of the following format:
Response ID (response type). This byte will contain 0x20.
Echo byte copied from the corresponding command. It is used to associate the response with the specific command.
Status of the command execution:
These bytes are reserved for future usage.
For convenience GPIO_SET_ADC_MODULE_CFG_RSP structure is declared in reports.h file.