You are here

Time Based Mode

In Time Based Mode pulses are counted only during user-defined time period. When this time period is exceeded, the counting starts again from 0 and the counter sends an event to the user application.

The pulse counter registers the number of detected pulses and the elapsed time. As in the case of Free Run Mode, in Time Based Mode you can suspend time and pulse counting, resume or reset it.

In Time Based Mode it is possible to set the time period, during which the pulses will be counted, and to change it. You can also retrieve this time period, as well as the elapsed time and the number of detected pulses.

To configure pulse counter settings, send GPIO_SET_PLS_CNT_CFG command. The Time Based Mode can be selected in Bits 7..4: PLS_CNT_MODE of Byte 3. You specify the time period in Bytes 5..7: LIMIT. This value is specified in units of 10 ms and can vary from 10 to 167,772,150 ms (46.5 h).

If you want to receive GPIO_EV_PLS_CNT event, when the pulse counter overflows, specify 1 in Bit 0: EV_OVERFLOW of Byte 3. The event will return the elapsed time. If you want to receive the event, when the time period is exceeded, specify 1 in Bit 2: EV_MATCH of Byte 3. You may also configure the pulse counter to send events periodically. The repeat interval is specified in Byte 4: REPEAT in units of 10 ms. In both these cases the events will return the number of detected pulses. For more detailed information about the event see Section 11.2, “Pulse Counter Event”.

You can suspend pulse counting by GPIO_SUSPEND_PLS_CNT command. This command suspends both time counting and pulse counting. If a pulse counter is suspended, it will not run until you send the GPIO_RESUME_PLS_CNT command.

You can reset the time count or pulse count with GPIO_RESET_PLS_CNT command. To change the defined time period, send GPIO_SET_PLS_CNT_LIMIT command (make sure that GPIO_PLS_CNT_VAL_TIME (1) value is specified in Byte 3: LIMIT_TYPE of this command). To retrieve this user-defined time period, useGPIO_GET_PLS_CNT_LIMIT command.

You can retrieve current number of pulses and timer readings with GPIO_GET_PLS_CNT_VAL command. To retrieve the pulse counter configuration settings, sendGPIO_GET_PLS_CNT_CFG command.