Counter

The counter is a millisecond counter.  It simply counts, a multiple of 1ms, and keeps incrementing a counter.  It starts when the device is plugged in, and will wrap the counter back to 0 when it overflows.

The counter is a virtual device.  It appears as a USB input value.  It doesn't have wire to wire to a pin.

What is it used for?  The counter can be used for a watch dog, updating the counter every 500ms, for example.  If the application doesn't receive an update every 500ms, it knows the Generic HID is on longer accessible.  This could be useful for CNC pendant controls, that should shut down the system if a fault occurs.

It can also be used to time between updates.  For example, if the counter was set to count every 1ms, it could be used to time the rate of encoder pulses and determine the velocity of the dial.

Properties

Name

Components can be given an optional name.  This is seen in the Test tab. Not all applications support the name.  Hidcomp/hidconfig supports names.

UsagePage/Usage

The UsagePage and Usage of the Counter. See Usages for more information.

Period

Period of the counter in milliseconds. Every 'Period' ms, the counter ticks. Setting it to 1, causes the counter to count milliseconds.  Setting to 1000, causes it to count in 1 second units.

Counter Bits

The size of counter variable. 1-16 bits.  A 1 bit counter will toggle between 0 and 1 every "period" milliseconds.  A 16 bit counter will count from 0 to 216-1 (65535).  At a 1ms period, this causes the number to wrap after 65.535 seconds.