Get data from a controlled counter
getCounter( counterno, param=COUNTER_VALUE )
Get data from a controlled counter.
The ezeio has 16 controlled, non-volatile, 64-bit counter registers.
These counters are saved in FRAM and are manipulated with incCounter / decCounter commands.
Any manipulation of the counter is time stamped.
counterno | Counter number (1-16) |
param | What parameter to return, see below |
COUNTER_VALUE | returns the counter value (low 32 bits) |
COUNTER_OVERFLOW | returns the counter wrap-count (high 32 bits) |
COUNTER_LASTINC | EPOCH time of last increment |
COUNTER_INCCOUNT | How many times the counter has been incremented |
COUNTER_LASTDEC | EPOCH time of last decrement |
COUNTER_DECCOUNT | How many times the counter has been decremented |
COUNTER_LASTRESET | When the counter was last reset to 0 |
Returns the requested property from the counter
new x; x = getCounter(1); // x has the value of the counter x = getCounter(1, COUNTER_DECCOUNT); // x has the count of how many times the counter has been decremented since it was last reset
See also incCounter/decCounter