You are here

GPIO_SET_ADC_MODULE_CFG (0x20)

The GPIO_SET_ADC_MODULE_CFG command switches on/off the ADC module of GPIO-24 adapter and configures the reference voltage.

GPIO_SET_ADC_MODULE_CFG Command

Go to Response

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:

Byte 0: GPIO_SET_ADC_MODULE_CFG (0x20)

This byte contains command ID (command type). It must be set to 0x20.

Byte 1: ECHO

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.

Byte 2: ON

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.

Byte 3: VREF

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:

Bits 7..2 Bit 1 Bit 0
Reserved VREF_LOW VREF_HI
Bits 7..2: Reserved

These bits are reserved for future usage and must be set to 0.

Bit 1: VREF_LOW

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.

Bit 0: VREF_HI

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

Byte 4: RESET_CHANNELS

The ADC channels Reset byte:

Bytes 5..7: Reserved

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.

GPIO_SET_ADC_MODULE_CFG Response

Go to Command

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:

Byte 0: GPIO_SET_ADC_MODULE_CFG (0x20)

Response ID (response type). This byte will contain 0x20.

Byte 1: ECHO

Echo byte copied from the corresponding command. It is used to associate the response with the specific command.

Byte 2: ST

Status of the command execution:

Bytes 3..7: Reserved

These bytes are reserved for future usage.

For convenience GPIO_SET_ADC_MODULE_CFG_RSP structure is declared in reports.h file.