You are here

GPIO_GET_PLS_CNT_CFG (0x1E)

The GPIO_GET_PLS_CNT_CFG command retrieves pulse counter configuration settings.

GPIO_GET_PLS_CNT_CFG Command

Go to Response

Byte 0 GPIO_GET_PLS_CNT_CFG Command ID (must be 0x1E)
Byte 1 ECHO Echo to associate the command with the response
Byte 2 PLS_CNT_NUMBER ID number of the counter, which settings will be retrieved.
Bytes 3..7 Reserved Reserved (must be 0)

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

Byte 0: GPIO_GET_PLS_CNT_CFG (0x1E)

This byte contains command ID (command type). It must be set to 0x1E.

Byte 1: ECHO

This byte is used to associate a response, received from GPIO-24 adapter, with the specific command. The response will contain exactly the same value in its echo byte.

Byte 2: PLS_CNT_NUMBER

The ID number of the pulse counter:

  • 0 – pulse counter on A.3 pin;

  • 1 – pulse counter on A.4 pin.

 

Bytes 3..7: Reserved

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

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

GPIO-24 adapter sends GPIO_GET_PLS_CNT_CFG response after command execution. Pulse counter configuration settings are specified inside the response.

GPIO_GET_PLS_CNT_CFG Response

Go to Command

Byte 0 GPIO_GET_PLS_CNT_CFG Response ID ( 0x1E)
Byte 1 ECHO Echo to associate a command with the response
Byte 2 ST Command execution status
Byte 3 Bits 7..3 Reserved Reserved
Bit 2 SUSPENDED Pulse counter state (suspended or not)
Bit 1 ON Pulse counting state (on/off)
Bit 0 PLS_CNT_NUMBER ID number of the counter, which settings are retrieved
Byte 4 Bits 7..4 PLS_CNT_MODE Pulse counter mode
Bit 3 Reserved Reserved
Bit 2 EV_MATCH Matcher (an event is sent when counter limits are exceeded)
Bit 1 Reserved Reserved
Bit 0 EV_OVERFLOW Matcher (an event is sent when maximum number of pulses is detected).
Byte 5 REPEAT Repeat interval value in units of 10 ms
Bytes 6..7 Reserved Reserved

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

Byte 0: GPIO_GET_PLS_CNT_CFG (0x1E)

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

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) – Pulse counter configuration 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).

 

Byte 3:
Bits 7..3 Bit 2 Bit 1 Bit 0
Reserved SUSPENDED ON PLS_CNT_NUMBER
Bits 7..3: Reserved

These bits are reserved for future usage.

Bit 2: SUSPENDED

Pulse counter state:

  • 0 – pulse counter is running;

  • 1 – pulse counter is in suspended state. It will not run until you send the GPIO_RESUME_PLS_CNT command.

 

Bit 1: ON

The pulse counter state (on/off):

  • 1 – the pin is switched to the pulse counter mode;

  • 0 – the pulse counter mode is switched off on the pin.

 

Bit 0: PLS_CNT_NUMBER

The ID number of the pulse counter:

  • 0 – pulse counter on A.3 pin;

  • 1 – pulse counter on A.4 pin.

 

Byte 4:
Bits 7..4 Bit 3 Bit 2 Bit 1 Bit 0
PLS_CNT_MODE Reserved EV_MATCH Reserved EV_OVERFLOW
Bits 7..4: PLS_CNT_MODE

The mode in which pulse counter operates:

  • GPIO_PLS_CNT_MODE_FREE_RUN(0) – pulses are counted until maximum number of pulses (16,777,215) is reached. For more detailed information seeSection 11.1.1, “Free Run Mode”.

  • GPIO_PLS_CNT_MODE_TIME_BASED(1) – pulses are counted only during user-defined time period. For more detailed information see Section 11.1.2, “Time Based Mode”.

  • GPIO_PLS_CNT_MODE_PULSE_BASED(2) – pulses are counted until user-defined number of pulses is detected. For more detailed information seeSection 11.1.3, “Pulse Based Mode”.

 

Bit 3: Reserved

This bit is reserved for future usage.

Bit 2: EV_MATCH
  • 1 – USB-I/O adapter will send the GPIO_EV_PLS_CNT event either when the time period is exceeded (Time Based Mode) or when the threshold number of pulses is detected (Pulse Based Mode). For more detailed information see Section 11.2, “Pulse Counter Event”;

  • 0 – the event is not generated when pulse counter limits are reached.

Bit 1: Reserved

This bit is reserved for future usage.

Bit 0: EV_OVERFLOW
  • 1 – USB-I/O adapter will send the GPIO_EV_PLS_CNT event when maximum number of pulses is reached. For more detailed information see Section 11.2, “Pulse Counter Event”;

  • 0 – the event is not generated when maximum number of pulses is reached.

Byte 5: REPEAT

The repeat interval for GPIO_EV_PLS_CNT event generation. If this byte is non-zero, GPIO-24 adapter sends events each REPEAT*10 ms. For more detailed information see Section 11.2, “Pulse Counter Event”.

Bytes 6..7: Reserved

These bytes are reserved for future usage.

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