Both frequency counters can notify the user when user-defined measurement limits are reached and send measurement results. For this purpose GPIO-24 adapter sends GPIO_EV_FR_CNT event to your application. The event returns the following information:
measured frequency (Bytes 2...4: FREQUENCY);
ID number of the frequency counter, from which measurement result has been retrieved (Byte 5: FR_CNT_NUMBER).
The conditions of the event generation are set with GPIO_SET_FR_CNT_CFG command as desribed below.
Set Byte 7: EVENT_COND to GPIO_FR_CNT_EV_NONE (0x00). The measured frequency can still be retrieved with GPIO_GET_FR_CNT_VAL command.
Set Byte 7: EVENT_COND to GPIO_FR_CNT_EV_ALWAYS (0x05). In this case events are sent periodically with predefined interval. Specify the interval in units of 100 ms in Byte 3: REPEAT. The repeat interval should be non-zero.
In Bytes 4..6: COMP_VAL you define threshold frequency. This value is constantly compared with measured frequency. The condition of the comparison is specified in Byte 7: EVENT_COND.
Byte 7: EVENT_COND can take on one of 4 different values:
GPIO_FR_CNT_EV_BELOW (0x01) – events are sent when the frequency is lower than the treshold value.
GPIO_FR_CNT_EV_NOT_EQ (0x02) – events are sent when the frequency is lower or higher than the treshold value.
GPIO_FR_CNT_EV_EQ (0x03) – events are sent when the frequency is equal to the treshold value.
GPIO_FR_CNT_EV_ABOVE (0x04) – events are sent when the frequency is higher than the treshold value.
You can also configure USB-I/O adapter to send
events repeatedly while the comparison condition exists. The repeat
interval in units of 100 ms is specified in Byte 3: REPEAT of
GPIO_SET_FR_CNT_CFG command. If the
repeat interval is zero, only one event is sent (when the
measurement limit is reached).