You are here

GPIO_GET_FR_CNT_CFG (0x17)

The GPIO_GET_FR_CNT_CFG command retrieves configuration settings for specified frequency counter.

GPIO_GET_FR_CNT_CFG Command

Go to Response

Byte 0 GPIO_GET_FR_CNT_CFG Command ID (0x17).
Byte 1 ECHO Echo to associate a command with the response.
Byte 2 FR_CNT_NUMBER The id number of frequency counter (0 and 1 values are available).
Byte 3..7 Reserved Reserved (must be 0).

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

Byte 0: GPIO_GET_FR_CNT_CFG (0x17)

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

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.

Byte 2: FR_CNT _NUMBER
  • 0 – frequency counter on A.3 pin;

  • 1 – frequency 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_FR_CNT_CFG_CMD structure is declared in reports.h file.

GPIO-24 adapter sends GPIO_GET_FR_CNT_CFG response after command execution. The frequency counter settings are specified inside the response.

GPIO_GET_FR_CNT_CFG Response

Go to Command

Byte 0 GPIO_GET_FR_CNT_CFG Response ID (0x17).
Byte 1 ECHO Echo to associate a command with the response.
Byte 2 Bit 7..4 ST Status of the command execution.
Bit 3..0 ON Frequency counter state.
Byte 3 REPEAT Repeat interval value in units of 100 ms.
Byte 4 COMP _VAL[2] Threshold frequency (least significant byte).
Byte 5 COMP _VAL[1] Threshold frequency (middle byte).
Byte 6 COMP _VAL[0] Threshold frequency (most significant byte).
Byte 7 EVENT _COND Condition of comparison.

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

Byte 0: GPIO_GET_FR_CNT_CFG (0x17)

This byte contains response ID (response type). This byte will contain 0x17.

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.

Byte 2:
Bits 7..4 Bits 3..0
ST ON
ST: 7..4 bits

Status of the command execution:

  • GPIO_ST_SUCCESS (0x00) – Frequency counter configuration has been succesfully retrieved;

  • GPIO_ST_INVALID_FR_CNT_NUMBER (0x0A) – Invalid ID number of the frequency counter has been specified (only 0 and 1 values are valid).

ON: 3..0 bits

The frequency counter state (on/off):

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

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

Byte 3: REPEAT

This byte contains the repeat interval in units of 100 ms for the event GPIO_EV_FR_CNT generation. If this byte is non-zero, GPIO-24 adapter sends events each REPEAT*100 ms. For more detailed information see Section 10.1, “Frequency Counter Event”.

Byte 4..6: COMP_VAL

The threshold frequency in Hz to be compared with. The counter calculates frequency and constantly compares it with the threshold frequency specified in Bytes 4..6: COMP_VAL.

Byte 4: COMP_VAL[2] – least significant byte (low byte) of threshold frequency.

Byte 5: COMP_VAL[1] – middle byte of threshold frequency.

Byte 6: COMP_VAL[0] – most significant byte (high byte) of threshold frequency.

Byte 7: EVENT_COND

The condition of the comparison:

  • GPIO_FR_CNT_EV_NONE (0x00) – No events are sent by current frequency counter.

  • GPIO_FR_CNT_EV_BELOW (0x01) – Events are sent when the frequency is lower than the threshold value specified in Bytes 4..6: COMP_VAL.

  • GPIO_FR_CNT_EV_NOT_EQ (0x02) – Events are sent when the frequency is lower or higher than the threshold value specified in Bytes 4..6: COMP_VAL.

  • GPIO_FR_CNT_EV_EQ (0x03) – Events are sent when the frequency is equal to the threshold value specified in Bytes 4..6: COMP_VAL.

  • GPIO_FR_CNT_EV_ABOVE (0x04) – Events are sent when the frequency is higher than the threshold value specified in Bytes 4..6: COMP_VAL.

  • GPIO_FR_CNT_EV_ALWAYS (0x05) – Events are sent periodically with predefined interval specified in Byte 3: REPEAT.

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