Specifications

Counter With Presets Program Example
The following example shows how to program the HSIO circuit to trigger on three preset
values. You may recall the industrial lathe example from the beginning of this chapter. This
example program shows how to control the lathe cutter head to make three grooves in the
work-piece at precise positions. When the lead screw turns, the counter device generates
pulses which the DL05 can count. The three preset variables A, B, and C represent the
positions (number of pulses) corresponding to each of the three grooves.
DL05 Micro PLC User Manual, 6th Edition, Rev. C
E–14
Appendix E: High-speed Input and Pulse Output Features
1
2
3
D
E
6
7
8
9
10
11
1
1
14
A
B
C
D
Industrial Lathe
A
Preset Data
V2320
0000
V2322 0000
V2324 0000
V2326 0000
1500
3780
4
850
FFFF
BC
A
B
C
Counter
Device
Start
Lead screw Cutter head
X4 - Cutter head retracted
Y0 - Lead screw motor
Y1 - Cutter head solenoid
X3 - Cutter head extended
I/O
Assignments
SP0
LD
K10
Load constant K10 into the accumulator . This
selects Mode 10 as the HSIO mode.
OUT
V7633
Output this address to V7633, the location of
HSIO Mode select register .
LD
K107
Load the constant required to configure X2 as
an external reset with interrupt.
OUT
V7636
Output the constant to V7636, the location of the
setup parameter for X2.
Select Mode 10
Direct SOFT32
SP0
ENI
Enable Interrupts before reaching a preset
generates an interrupt. Special Relay SP0 is on
during the first CPU scan.
LDD
K1500
Load the preset A value into the accumulator.
OUTD
V2320
Output the accumulator contents to the memory
location for preset 1.
LDD
K3780
Load the preset B value into the accumulator .
OUTD
V2322
Output the accumulator contents to the memory
location for preset 2.
Load Presets
SP0
LDA
O2320
Load the octal address O2320 into the
accumulator. This instruction automatically
converts the address into hex.
OUT
V7630
Output this address to V7630, the location of
the pointer to the Preset Table.
LD
K1
Load the constant required to configure X0 as
the counter clock.
OUT
V7634
Output the constant K1 to V7634, the location of
the setup parameter for X0.
DirectSOFT