The GPIO_SET_PLS_CNT_LIMIT command specifies pulse counter limits – time period or threshold number of pulses – for Time Based Mode and Pulse Based Mode, correspondingly. For the pulse counter in Free Run Mode this command has no sense.
| Byte 0 | GPIO_SET_PLS_CNT_LIMIT | Command ID |
| Byte 1 | ECHO | Echo to associate command with the response |
| Byte 2 | PLS_CNT_NUMBER | ID number of the counter, which limit will be configured. |
| Byte 3 | LIMIT_TYPE | Type of the counter limit (time period or threshold number of pulses) |
| Byte 4 | LIMIT[2] | Counter limit (time period or threshold number of pulses) |
| Byte 5 | LIMIT[1] | |
| Byte 6 | LIMIT[0] | |
| Byte 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 0x28.
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 specified in Bytes 4..6: LIMIT:
GPIO_PLS_CNT_VAL_PULSES (0) – Bytes 4..6: LIMIT contain the threshold number of pulses.
GPIO_PLS_CNT_VAL_TIME (1) – Bytes 4..6: LIMIT contain the time period in units of 10 ms.
These bytes contain pulse counter limits.
If Byte 3: LIMIT_TYPE = GPIO_PLS_CNT_VAL_TIME (1) – Bytes 4..6: LIMIT define the time period in units of 10 ms up to 16,777,215 (167,772,150 ms or 46.5 h).
If Byte 3: LIMIT_TYPE = GPIO_PLS_CNT_VAL_PULSES (0) – Bytes 4..6: LIMIT define the threshold number of pulses up to 16,777,215.
Byte 4: LIMIT[2] – least significant byte (low byte) of a pulse counter limit.
Byte 5: LIMIT[1] – middle byte of threshold a pulse counter limit.
Byte 6: LIMIT[0] – most significant byte (high byte) of a pulse counter limit.
This byte is reserved for future usage and must be set to 0.
For convenience GPIO_SET_PLS_CNT_LIMIT_CMD structure is declared in reports.h file.
GPIO-24 adapter sends GPIO_SET_PLS_CNT_LIMIT response after command execution.
| Byte 0 | GPIO_SET_PLS_CNT_LIMIT | Response ID |
| Byte 1 | ECHO | Echo to associate 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:
Response ID (response type). This byte will contain 0x28.
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 limit has succesfully been set;
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 limit type has been specified.
These bytes are reserved for future usage.
For convenience GPIO_SET_PLS_CNT_LIMIT_RSP structure is declared in reports.h file.