From: David Schleef Date: Fri, 8 Jun 2001 22:36:34 +0000 (+0000) Subject: More busy-talk about counters X-Git-Tag: r0_7_60~178 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=68f2a7ef66f5f29118972b12b39e74c9c54d1e91;p=comedi.git More busy-talk about counters --- diff --git a/Documentation/comedi/counter-spec b/Documentation/comedi/counter-spec index 3daeaa0c..9eb92f8f 100644 --- a/Documentation/comedi/counter-spec +++ b/Documentation/comedi/counter-spec @@ -1,4 +1,81 @@ +A counter is an input device, "counting" the number of triggers +that occur while the gate is enabled. A timer is an output +device. + +counter "command" + +{ + unsigned int mode; + + unsigned int src1_src; + unsigned int src1_arg; + + unsigned int src2_src; + unsigned int src2_arg; + + unsigned int gate_src; + unsigned int gate_arg; +} + +Counter examples: + + (Unless otherwise specified, _src's are TRIG_NONE.) + + Counting up at a rate of 1/ms: + + mode = UP_COUNTER; + src1_src = TRIG_TIMER; + src1_arg = 1000000; + + Counting down at a rate of 1/ms: + + mode = DOWN_COUNTER; + arg1_src = TRIG_TIMER; + arg1_arg = 1000000; + + Counting up at each rising transition of digital input 4: + + mode = UP_COUNTER; + src1_src = TRIG_EXT; + src1_arg = 4 | TRIG_EXT_RISING; + + Quadrature counting on di 0,1: + + mode = QUADRATURE; + src1_src = TRIG_EXT; + src1_arg = 0; + src2_src = TRIG_EXT; + src1_arg = 1; + + Interval timing of digital input 4: + + Counter setup: + + mode = UP_COUNTER; + src1_src = TRIG_TIMER; + gate_src = TRIG_EXT; + gate_arg = 4 | LEVEL_1; + event_src = TRIG_EXT; + event_arg = 4 | FALLING_EDGE; + + flags = COUNT_RESET; /* counter resets at every event */ + + Command setup: + + start_src = TRIG_NOW; + scan_begin_src = TRIG_NOW; + convert_src = TRIG_FOLLOW; + scan_end_src = TRIG_COUNT; + scan_end_arg = 1; + stop_src = whatever; + + +Timer examples: + + + + Counters are based on a number of digital inputs, typically 2 or 3, and the count is changed due to the transition of one line and the status of other lines.