The GPIO_GET_PLS_CNT_VAL command retrieves current number of detected pulses or elapsed time for specified pulse counter.
| Byte 0 | GPIO_GET_PLS_CNT_VAL | Command ID (must be 0x1F) |
| Byte 1 | ECHO | Echo to associate the command with the response |
| Byte 2 | PLS_CNT_NUMBER | ID number of the counter, which readings will be retrieved. |
| Byte 3 | VALUE_TYPE | Type of the counter value (elapsed time or current number of detected pulses) |
| Bytes 4..7 | Reserved | Reserved |
Command is an 8-byte array of the following format:
This byte contains command ID (command type). It must be set to 0x1F.
This byte can be 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 ID number of the pulse counter:
0 – pulse counter on A.3 pin;
1 – pulse counter on A.4 pin.
The type of value to be returned in the response:
GPIO_PLS_CNT_VAL_PULSES (0) – The response will contain the number of detected pulses.
GPIO_PLS_CNT_VAL_TIME (1) – The response will contain the elapsed time in units of 10 ms.
These bytes are reserved for future usage and must be set to 0.
For convenience GPIO_GET_PLS_CNT_VAL_CMD structure is declared in reports.h file.
GPIO-24 adapter sends GPIO_GET_PLS_CNT_VAL response after command execution. Current pulse counter readings are specified inside the response.
| Byte 0 | GPIO_GET_PLS_CNT_VAL | Command ID (must be 0x1F) |
| Byte 1 | ECHO | Echo to associate the command with the response |
| Byte 2 | ST | Command execution status |
| Byte 3 | PLS_CNT_NUMBER | ID number of the counter, which readings are retrieved. |
| Byte 4 | VALUE_TYPE | Type of the counter value (elapsed time or current number of detected pulses) |
| Byte 5 | VALUE[2] | Current number of detected pulses or elapsed time |
| Byte 6 | VALUE[1] | |
| Byte 7 | VALUE[0] |
Response is an 8-byte array of the following format:
Response ID (response type). This byte will contain 0x1F.
Echo byte copied from the corresponding command. It can be used to associate the response with the specific command.
Status of the command execution:
GPIO_ST_SUCCESS (0x00) – Pulse counter readings has succesfully been retrieved;
GPIO_ST_INVALID_PLS_CNT_NUMBER (0x0A) – Invalid ID of the pulse counter has been specified (only 0 and 1 values are valid);
GPIO_ST_INVALID_PARAMETER (0x0B) – Unsupported pulse counter value type has been specified.
The ID number of the pulse counter:
0 – pulse counter on A.3 pin;
1 – pulse counter on A.4 pin.
The type of value specified in Bytes 5..7: VALUE:
GPIO_PLS_CNT_VAL_PULSES (0) – Bytes 5..7: VALUE contain the number of detected pulses.
GPIO_PLS_CNT_VAL_TIME (1) – Bytes 5..7: VALUE contain the elapsed time in units of 10 ms.
If Byte 4: VALUE_TYPE equals to GPIO_PLS_CNT_VAL_PULSES (0), Bytes 5..7: VALUE contain the time period in units of 10 ms, that have passed since last reset of the pulse counter.
If Byte 4: VALUE_TYPE equals to GPIO_PLS_CNT_VAL_TIME (1), Bytes 5..7: VALUE contain current number of pulses counted since last reset of the pulse counter.
Byte 5: VALUE[2] – least significant byte (low byte) of a pulse counter readings.
Byte 6: VALUE[1] – middle byte of threshold a pulse counter readings.
Byte 7: VALUE[0] – most significant byte (high byte) of a pulse counter readings.
For convenience GPIO_GET_PLS_CNT_VAL_RSP structure is declared in reports.h file.