High-Speed Input and
Pulse Output Features
3–22
High-speed Input and Pulse Output Features
SP0
LD
K20
Load constant K20 into the accumulator. This selects
Mode 20 as the HSIO mode.
OUT
V7633
Output this address to V7633, the location of the HSIO
Mode select register.
LD
K2
Load the constant required to configure X0 as Phase A
input.
OUT
V7634
Output the constant to V7634, the location of the setup
register for X0.
DirectSOFT
UDC
CT76
Kxxxxxxxx
C1
C0
C2
END
END coil marks the end of the main program..
CT76 is the HSIO quadrature counter. The first rung’s SP1
always enables the counter. The dummy input is used by
the built-in compiler.
LD
K0
Load the constant required to configure X1 as Phase B
input.
OUT
V7635
Output the constant to V7635, the location of the setup
register for X1.
LD
K7
Load the constant required to configure X2 as an external
reset.
OUT
V7636
Output the constant to V7636, the location of the setup
register for X2.
SET
Set C0 on at powerup to enable counting.
C0
SP0
Select Mode 20
The third rung’s Reset input is normally off,
because we will use the external reset. You can
optionally reset the counter value on each powerup
using the SP0 contact.
SP1
LDD
V1076
Load the current value of the counter into the accumulator
on each scan.
CMPD
K44292
Compare the value in the accumulator with the constant
K44292. If they are equal, the SP61 contact will be
turned on.
Select Mode 20
Set Y0 to ON when the counter reaches or exceeds
our comparison value while COUNTING UP.
* Note: You can reset Y0 later in the
ro
ram b
usin
the RST insturuction.
SP61
SET
Y0
*
SP62
SP61
SET
Y1
*
SP60
Set Y1 to ON when the counter reaches or goes below
our comparison value while COUNTING DOWN.
To preload the counter, just add the following example rungs to the program above.
Program
Example Cont’d