Mode counter function m, Function, Selected encoder channel – Sensoray 421 User Manual
Page 8

Page 6
Sensoray Model 421 Instruction Manual
Command Functions
The CNTCTL port is used to invoke all counter
command and configuration functions. Three counter
operations may be accessed through this port: Latch
counts, Reset counts, and Mode set. See the box
below for details.
The Latch command synchronously transfers the
specified counter’s contents to the 16-bit data
holding register. A Latch command must be executed
before the contents of a counter may be read. Note
that counters may not be read directly
—
counter
contents must first be transferred to the holding
register, then read from the holding register.
The Reset command resets the specified counter to
zero. The affected counter is automatically reenabled
for counting within 2 microseconds following a
Reset command.
Note that the act of writing a Reset command to the
CNTCTL port triggers a counter reset operation.
After invoking a counter Reset command, no further
action is required by the ISAbus host processor to
enable counting on the affected channel.
The Mode command specifies the operating mode
for all three counter channels. Three functional
attributes are specified by the selected mode: clock
multiplier, number of active phases and count
direction.
The clock multiplier determines the number of count
events per cycle on the “A” phase input. A count
event is a phase input state transition that causes
either an increment or decrement of the associated
encoder counter. For example, a “x2” multiplier
means that 2 count events will occur for each cycle
of the “A” phase input. Refer to the counter timing
diagram for more information.
Either one or two active phases may be selected. One
of the 2-phase modes must be selected when using
Quadrature-encoded inputs. A 1-phase mode must be
selected when using a single-phase clock source.
“Count direction” is specified as either normal or
reverse. Select the counting direction (see timing
diagram) best suited for your application.
When M
1
=1, M
0
S
1
S
0
selects the counter mode for all
three counter channels:
Mode
Counter Function
M
0
S
1
S
0
Clk
Phases
Count Direction
0
000
x2
2
Normal
1
001
x4
2
Normal
2
010
x1
2
Normal
3
011
x1
1
Normal
4
100
x2
2
Reverse
5
101
x4
2
Reverse
6
110
x1
2
Reverse
7
111
x1
1
Reverse
M
1
M
0
specifies the operation to be performed:
M
1
M
0
Function
00
Latch counter S
1
S
0
contents
01
Reset counter S
1
S
0
to zero
1x
Select operating mode M
0
S
1
S
0
CNTCTL (14):
0
0
0
0
M
1
M
0
S
1
S
0
When M
1
=0, S
1
S
0
selects the counter channel
to be operated on:
S
1
S
0
Selected Encoder Channel
00
Channel 0
01
Channel 1
10
Channel 2
11
Reserved for future use