You are here

GPIO_GET_VAL (0x09)

The GPIO_GET_VAL command retrieves current values on the I/O pins.

This command retrieves:

current input values:

for digital input pins;

current output values:

for digital output pins;

for pulse width modulation (PWM) pins;

for pins sending a single pulse.

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

GPIO-24 adapter sends GPIO_GET_VAL response after command execution. The current values on the I/O pins are specified inside the response.

GPIO_GET_VAL Command

Go to Response

Byte 0 GPIO_GET_VAL Command ID (0x09).
Byte 1 ECHO Echo to associate a command with the response.
Byte 2..7 Reserved Reserved (must be 0).

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

Byte 0: GPIO_GET_VAL (0x09)

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

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.

Bytes 2..7: Reserved

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

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

GPIO-24 adapter sends GPIO_GET_VAL response after command execution. The current values on I/O pins are specified inside the response.

GPIO_GET_VAL Response

Go to Response

Byte 0 GPIO_GET_VAL Response ID (0x09).
Byte 1 ECHO Echo to associate a command with the response.
Byte 2 ST Status of the command execution.
Byte 3 PORT A I/O port A pins values.
Byte 4 PORT B I/O port B pins values.
Byte 5 PORT C

I/O port C pins values.

Byte 6..7 Reserved Reserved

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

Byte 0: GPIO_GET_VAL (0x09)

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

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:

  • GPIO_ST_SUCCESS (0x00) – The I/O pins values were successfully retrieved.

Byte 3: PORT A

I/O port A pins values.

Byte 4: PORT B

I/O port B pins values.

Byte 5: PORT C

I/O port C pins values.

Bytes 6..7: Reserved

These bytes are reserved for future usage.

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