5 setting up the counter source – Sensoray 626 User Manual
Page 21

Sensoray Model 626 Instruction Manual
19
10.5 Setting Up the Counter Source
Counter A & counter B can be driven by a differential or single ended encoder, the digital inputs,
software or from the system clock. Each counter’s input logic has a count, direction & index line that
can be controlled.
The ‘Counter A Source’ bits are used to select counter A’s source. (See Table 15 & Table 16 P18)
If ‘Counter A Source’=00 then encoder inputs are selected.
If ‘Counter A Source’=01 then the digital inputs control the counters.
Table 18 Digital inputs as Counter input controls
Digital Input Channel
Counter
Counter Input Function
1
0 A
Count or direction input
2
0 A
Count input
3
0 A
Index input
4
0 B
Count or direction input
5
0 B
Count input
6
0 B
Index input
7
1 A
Count or direction input
8
1 A
Count input
9
1 A
Index input
10
1 B
Count or direction input
11
1 B
Count input
12
1 B
Index input
13
2 A
Count or direction input
14
2 A
Count input
15
2 A
Index input
16
2 B
Count or direction input
17
2 B
Count input
18
2 B
Index input
When the digital inputs are selected as the source then the corresponding digital inputs can be used to
control the counters in much the same way as when the encoder inputs are used. This mode also gives
software control of the counters. This is achieved by writing to the corresponding digital output that in
tern will change the digital input and thus the counter. The disadvantage to doing this is the fact that the
digital output is now used for counter control & cannot be used for normal I/O functions.
In mode 00 & 10 above, the ‘Counter A Source Edge Selection’ is used to select positive ‘0’ or negative
‘1’ edge selection.
If ‘Counter A Source’ =10 then the counter will count down with the system clock.
If ‘Counter A Source’ =11 then the counter will count up with the system clock.
In both these modes the ‘Counter A Multiplier’ must be 10 and ‘Counter A Source Edge Selection’ must
be 1. These two bits become part of the oscillator feedback loop. ‘Counter A Source Edge Selection’
could be used as an enable. The timer will only run when it is ’1’.
‘Counter A Enable’ is used to gate the counter under normal counting operation. When cleared counting
is enabled and when set counting is disabled. When using software to control counter A, ‘Counter A
Enable’ must be ‘1’ to enable counting.
The ‘Counter A Index Source’ bits are used to select counter A’s index source.
If ‘Counter A Index Source’=00 then the encoder index input will control indexing.
If ‘Counter A Index Source’=01 then the digital inputs control the indexing. While in this mode
‘Counter A Index Edge Selection’=0 will index on the positive edges while 1 will index on the negative
edges.