USB-IO Interface Adapter GPIO-24. Programmers Reference Manual.


3.1.9. GPIO_GET_VAL

Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7
GPIO_ GET_VAL (0x09) ECHO 0 0 0 0 0 0

The GPIO_GET_VAL command retrieves levels present on the I/O pins:

  • For input pins the current input value is retrieved.
  • For output pins the current output value is retrieved.
  • For pulse width modulation (PWM) pins the current output value is retrieved.
  • For pins executing a single pulse the current output value is retrieved.

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

Byte 0: GPIO_GET_VAL (0x09)
This byte contains command identifier (command type). It should be set to 0x09.
Byte 1: ECHO
This byte can be used to associate a response received from GPIO-24 adapter with specific command. Response will contain exactly the same value in its echo byte.
Byte 2..7: Reserved
These bytes are reserved for future use and have to be set to 0.

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

typedef struct _GPIO_GET_VAL_CMD
{
   unsigned char id; //  = GPIO_GET_VAL;
   unsigned char echo;
   unsigned char reserved[6]; // must be 0
} __PACKED_ATTR GPIO_GET_VAL_CMD, *PGPIO_GET_VAL_CMD;

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