You are here

GPIO_SET_ADC_CHANNEL_CFG (0x21)

The GPIO_SET_ADC_CHANNEL_CFG command configures the conditions of GPIO_EV_ADC event generation.

GPIO_SET_ADC_CHANNEL_CFG Command

Go to Response

Byte 0 GPIO_SET_ADC_CHANNEL_CFG Command ID (0x21).
Byte 1 ECHO Echo to associate a command with the response.
Byte 2 Bits 7..4 EVENT_CONDITION Condition of the event generation
Bits 3..0 CHANNEL ID number of the ADC channel
Byte 3 REPEAT Repeat interval value in units of 10 ms
Byte 4 LOW_LSB Low threshold value (least significant byte)
Byte 5 LOW_MSB Low threshold value (most significant byte)
Byte 6 HI_LSB High threshold value (least significant byte)
Byte 7 HI_MSB High threshold value (most significant byte)

Command is an 8-byte array of the following format:

Byte 0: GPIO_SET_ADC_CHANNEL_CFG (0x21)

This byte contains command ID (command type). It should be set to 0x21.

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:
Bits 7..4 Bits 3..0
EVENT_CONDITION CHANNEL
Bits 7..4: EVENT_CONDITION

The bits define the condition when USB-I/O adapter sends GPIO_EV_ADC event. It can take on one of the following values:

  • GPIO_ADC_EV_NONE (0x0) – No events are sent for current ADC channel.

  • GPIO_ADC_EV_BELOW (0x1) – The event is sent when the input voltage descends below the low threshold value. High threshold value is ignored.

  • GPIO_ADC_EV_ABOVE (0x2) – The event is sent when the input voltage rises above high threshold value. Low threshold value is ignored.

  • GPIO_ADC_EV_OUTSIDE (0x3) – The event is sent when the input voltage exceeds the limits specified by low and high threshold values.

  • GPIO_ADC_EV_INSIDE (0x4) – The event is sent when the input voltage is within the limits specified by low and high threshold values.

  • GPIO_ACD_EV_ALWAYS (0x5) – The events are sent periodically with predefined interval. The non-zero repeat interval is specified in Byte 3: REPEAT.

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

Bits 3..0: CHANNEL

The number of ADC channel:

  • 0 – C.1 pin;

  • 1 – C.2 pin;

  • 2 – C.5 pin;

  • 3 – C.6 pin;

  • 4 – B.3 pin.

Byte 3: REPEAT

This byte defines the repeat interval for GPIO_EV_ADC event generation. If this byte is non-zero, GPIO-24 adapter sends events each REPEAT * 10 ms. For more detailed information see Section 7.4, “ADC Event”.

Bytes 4..7: LOW_LSB/LOW_MSB/HI_LSB/HI_MSB

These bytes define low and high threshold values. You can set any value from 0 to 0x3FF as low and high threshold values. 0 corresponds to VRefLow and 0x3FF corresponds to VRefHi voltage.

Byte 4: LOW_LSB – least significant byte of low threshold value.

Byte 5: LOW_MSB – most significant byte of low threshold value.

Byte 6: HI_LSB – least significant byte of high threshold value.

Byte 7: HI_MSB – most significant byte of high threshold value.

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

GPIO-24 adapter sends GPIO_SET_ADC_CHANNEL_CFG response after command execution.

GPIO_SET_ADC_CHANNEL_CFG Response

Go to Command

Byte 0 GPIO_SET_ADC_CHANNEL_CFG Response ID (0x21).
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_CHANNEL_CFG (0x21)

This byte contains response ID (response type). This byte will contain 0x21.

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: ST

Status of the command execution:

  • GPIO_ST_SUCCESS (0x00) – ADC channel configuration was succesfully configured.

Bytes 3..7: Reserved

These bytes are reserved for future usage.

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