The text of a manual · part 29 of 38
DL06 Micro PLC User Manual, Volume 2 of 2, pages 280 to 289
Pages 280 to 289 of 370
The original document is the PDF (6.0 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
Page 280
Appendix E: High-speed Input and Pulse Output Features
Program Example 1: Quadrature Counting with an Interrupt
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D
Below is a simple example of how quadrature counting with an interrupt can be programmed. DirctSOFT
DirectSOFT
ENI SP0
Load constant K20 into the accumulator. This selects Mode 20 as the HSIO mode.
LD K20 OUT V7633
Output this value to V7633, the location of the HSIO Mode select register.
LD
K2
Load the constant required to configure X0 and X1 as a quadrature absolute input.
OUT V7634
Output the constant to V7634, the location of the setup register for X0.
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 register for X2.
LD K2006
Load the constant required to configure X3 as a filtered input.
OUT V7637
Output the constant to V7637, the location of the setup register for X3.
LDD K5000
Load the preset 1 value into the accumulator.
OUTD V3630
Output the accumulator contents to the memory location for preset 1.
LDD K10000
Load the preset 2 value into the accumulator.
OUTD V3632
Output the accumulator contents to the memory location for preset 2.
LDD K15000
Load the preset 3 value into the accumulator.
OUTD V3634
Output the accumulator contents to the memory location for preset 3.
LDD KFFFF
Load the constant FFFF into the accumulator. This value represents the end of the preset list.
OUTD V3636
Output the accumulator contents to the memory location for preset 4 (end of preset marker).
SP1 UDC
CT174
SP1 K18724
CT174 is the HSIO quadrature counter . The first rung’s SP1 always enables the counter. The dummy input is used by the built-in compiler.
SP1
END
END coil marks the end of the main program..
continued on next page
E–30
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 281
Appendix E: High-speed Input and Pulse Output Features continued from last page
1 2 3 4 E The Load Accumulator instructions have set up the V-memory as required, i.e. 20 in V7633 for the mode and 0202 in V7634 to designate the standard up/down with the absolute preset mode. By placing 0107 in V7636, an external reset for counter CT174 is selected and it will 6 execute interrupt 0 on the rising edge of the reset. Presets for up/down counting have been stored in memory locations V3630 through V3635. The next even numbered location 7 following this has FFFF to indicate we have no more presets. 8 9 10 11 12 13 14 A B C D INT O0
SP540
Y0 OUT
Set Y0 to ON when the counter reaches or exceeds our comparison value while COUNTING UP.
SP541
Y1 OUT
Set Y1 to ON when the counter reaches or goes below our comparison value while COUNTING DOWN.
IRT
DL06 Micro PLC User Manual, 3rd Edition Rev. A
E–31
Page 282
Appendix E: High-speed Input and Pulse Output Features
Program Example 2: Up/Down Counting with Standard Inputs
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D
In this example, there is a conveyor belt “A” that transports bottles to be inspected. During the course of the process, one sensor is keeping track of the bottles that are going onto belt “A” for inspection, and another sensor is keeping track of how many bottles are being removed to the finished product line. When we have reached 500 bottles in the process, an “over 500” light turns on and a rerouting gate is activated to channel the incoming bottles to conveyor belt “B”. The rerouting gate will stay activated for 30 seconds after the conveyor belt “A” contains less than 500 bottles. The program below shows how ladder logic might be written to handle the job. Note the use of V1174. This memory location stores the current count for CT174 which is used with the DL06. DirectSOFT 5 SP0
LD K20 Mode 20 Up/Down counter
OUT V7633 LD K202
Standard counting Absolute preset mode at X0 and X1
OUT V7634 LD K0 Must be zero with mode 20
OUT V7635 LD K7 External reset without interrupt (X2)
OUT V7636 LD K1006 Discrete filtered input at (X3) 10 ms.
OUT V7637 SP1 UDC
CT174
Up/Down counter Only one counter is used with mode 20. The actual count (32-bit) is stored in V1175/V1174. When pulses are received at point X1, the value in V1175/V1174 will decrement.
SP1 K500 SP1
Actual counts
V1174
K450
Y20 OUT
When the pulse count reaches and exceeds 450, the "over 450" light (Y20) will turn on.
Continued on next page.
E–32
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 283
Appendix E: High-speed Input and Pulse Output Features continued from previous page
Counter output
Over 500 light
CT174
When the pulse count reaches or exceeds the preset value of 500, the output of the OUT counter (CT174) goes high and turns on Over 500 latch the "over 500" light (Y21) and latches C5.
Y21
C5 SET Over 500 latch
C5
Y22 OUT
When the count is 500 or greater, the rerouting gate (Y22) turns on and will stay on for 30 seconds after the count falls below 500.
Counter output
CT174
TMR TIMER 0 OUTPUT TO K300 Over 500 latch
T0
C5 RST
END
END coil marks the end of the main program.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D E–33
Page 284
Appendix E: High-speed Input and Pulse Output Features
Program Example 3: Quadrature Counting
1 2 3
In this example, a wooden workpiece is being drilled with 3 holes and then the holes are injected with glue for dowels to be inserted at another workstation. A quadrature encoder is connected to a positioning table which is moving a drill press horizontally over the workpiece. The positioning table will stop and the drill press will lower to drill a hole in an exact location. After the three holes are drilled in the workpiece, the positioning table reverses direction and injects glue into the same holes. DirectSOFT 5
4 E 6 7 8 9 10 11 12 13 14 A B C D
ENI SP0
Enable interrupts
LD K20 Mode 20
OUT V7633 LD K2 OUT V7634
Quadrature counting absolute mode at X0 and X1
LD K0 Must be zero
OUT V7635 LD K107
External reset w/interrupt (X2)
OUT V7636 LD K1006
Discrete filtered input at (X3) 10 ms.
OUT V7637 SP0
LDD K5000 OUTD V3630
Presets for up counting. This rung loads the counter's presets. In this case, the absolute preset mode has been selected.
LDD K6000 OUTD V3632 LDD K7500 OUTD V3634 LDD K8000 OUTD V3636 LDD KFFFF
Tell CPU that there are no more presets.
OUTD V3640
Continued on next page.
E–34
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 285
Appendix E: High-speed Input and Pulse Output Features Continued from previous page.
Forwarding positioning table.
Manual start of drilling process momentary PB.
Y30
X20
SET C1
C1
RST Drilling sequence completed (one hole only).
Drilling sequence completed (one hole only).
1st preset actual counts.
Reversing Position Table.
V3630 V1174
V1174
K5100
Y31
Glue injection.
Y32 OUT
2nd preset actual counts.
V3632 V1174
V1174
K6100
3rd preset actual counts.
V3634 V1174
V1174
K7600
SP1 UDC
CT174
SP1 K8388607 SP1
Drilling sequence initiation.
C5
One-shot bit.
C6 PD
One-shot bit.
Drill press down.
Y20
C6
SET Drill turning.
Y21 SET Drill fully extended. Limit switch 1. X10
Drill press down.
Y20 RST Drill press up.
Y22 Drill fully retracted. (home position) Limit switch 2. X3
SET One-shot bit.
C7 PD
Continued on next page.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D E–35
Page 286
Appendix E: High-speed Input and Pulse Output Features Continued from previous page.
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D E–36
One-shot bit. First scan bit.
C7
Drill press down.
SP1
Y22 RST Drill turning.
Y21 RST Drilling sequence completed (one hole only).
C1 SET Drilling sequence initiation.
C5 RST END INT O0
SP540
Forwarding Positioning Table.
Y30 OUT
Drilling sequence initiation.
C5 SET SP541
Forwarding Positioning Table.
Y30 OUT
Drilling sequence initiation.
C5 SET SP542
Forwarding Positioning Table.
Y30 OUT
Drilling sequence initiation.
C5 SET SP543
Forwarding Positioning Table.
Y30 OUT Reversing Positioning Table.
Y31 SET Drilling sequence initiation.
C5 Position Table home limit switch (resets counter to zero).
X2
SET Reversing Positioning Table.
Y31 RSTI
IRT
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 287
Appendix E: High-speed Input and Pulse Output Features
Troubleshooting Guide for Mode 20 If you’re having trouble with Mode 20 operation, please study the following symptoms and possible causes. The most common problems are listed below.
1 Symptom: The counter does not count. 2 Possible causes: 1. Field sensor and wiring – Verify that the encoder or other field device inputs actually turn on and 3 illuminates the status LEDs for X0 and X1. A standard incremental encoder will visibly, alternately turn on the LEDs for X0 and X1 when rotating slowly (1 RPM). Or, the problem could be due to a sinking-sourcing wiring problem, etc. Remember to check the signal ground connection. Also 4 verify that the pulse on-time, duty cycle, voltage level, and frequency are within the input specifications. E 2. Configuration – make sure all of the configuration parameters are correct. V7633 must be set to 20, and V7634 must be set to “0002” to enable the Phase A input, and V7635 must be set to “0000” to enable the Phase B input. 6 3. Stuck in reset – check the input status of the reset input, X2. If X2 is on, the counter will not count because it is being held in reset. 7 4. Ladder program – make sure you are using counter CT174 in your program. The top input is the enable signal for the counter. It must be on before the counter will count. The middle input is the dummy input and must be off for the counter to count. The bottom input is the counter reset, and 8 must be off during counting. Symptom: The counter counts in the wrong direction 9 (up instead of down, and visa-versa). Possible causes: 10 1. Channel A and B assignment – It’s possible that Channel A and B assignments of the encoder wires is backwards from the desired rotation/counting orientation. Just swap the X0 and X1 inputs, 11 and the counting direction will be reversed. Symptom: The counter counts up and down but will not reset. 12 Possible causes: 1. Check the LED status indicator for X2 to make sure it is active when you want a reset. Also verify 13 the configuration register V7636 for X2 is set to 7. Or, if you are using an internal reset, use the status mode of DirectSOFT 5 to monitor the reset input to the counter. 14 A B C D DL06 Micro PLC User Manual, 3rd Edition Rev. A
E–37
Page 288
Appendix E: High-speed Input and Pulse Output Features
Mode 30: Pulse Output
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D
Purpose
E–38
The HSIO circuit in Mode 30 generates output pulse trains suitable for open-loop control of a single-axis motion positioning system. It generates pulse (stepper increment) and direction signals which you can connect to motor drive systems and perform various types of motion control. Using Mode 30 Pulse Output, you can select from three profile types detailed later in this appendix:
Trapezoidal Profile Velocity
Decel
Accel
Time
• Automatic Trapezoidal – Accel Slope to Target Velocity to Decel Slope • Step Trapezoidal – User defined step acceleration/deceleration and target velocity • Velocity Control – Speed and Direction only
The HSIO circuit becomes a high-speed pulse generator (up to 10 kHz) in Mode 30. By programming acceleration and deceleration values, position and velocity target values, the HSIO function automatically calculates the entire motion profile. The figure below shows the DL06 generating pulse and direction signals to the drive amplifier of a stepper positioning system. The pulses accomplish the profile independently and without interruption to ladder program execution in the CPU. Pulse
DL06 Micro PLC Stepper Motor
Direction
G LG Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17 0V AC(L) AC(N) 24V C0 Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 N.C. OUTPUT: 6-240V
Y
X
0
1
2
50 - 60Hz 3
INPUT: 12 - 24V
4
5
2.0A, 6 - 27V 6
7
10
2.0A 11
12
PWR: 100-240V 13
14
15
16
PWR RUN CPU TX1 RX1 TX2 RX2
50-60Hz 40VA 17
20
D0-06DR
21 22
23
3 - 15mA
LOGIC C0
06
K oyo
X1 X0
Drive Amplifier
X3 X2
X4 C1
X6 X5
X7
C2 X11 X13 X14 X16 C4 X21 X23 N.C. X10 X12 C3 X15 X17 X20 X22 N.C.
TERM PORT1
PORT2
RUN STOP
In the figure above, the DL06 generates pulse and direction signals. Each pulse represents the smallest increment of motion to the positioning system (such as one step or micro-step to a stepper system). Alternatively, the HSIO Pulse Output Mode may be configured to deliver counter clock-wise (CCW) and clock-wise (CW) pulse signals as shown to the right.
CCW Pulse
CW Pulse
Drive Amplifier
NOTE: The pulse output is designed for open loop stepper motor systems. This, plus its minimum velocity of 40 pps make it unsuitable for servo motor control.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 289
Appendix E: High-speed Input and Pulse Output Features
Functional Block Diagram The diagram below shows HSIO functionality in Mode 30. When the lower byte of HSIO Mode register V7633 contains a BCD “30”, the pulse output capability in the HSIO circuit is enabled. The pulse outputs use Y0 and Y1 terminals on the output connector. Remember that the outputs can only be DC type to operate.
1 2 3 Output Circuit DL06 PLC 4 HSIO E SP 104 Profile Complete CPU Y0 Start Profile PULSE GEN 6 Y1 Preload Position Value X1 Filtered Input V-memory FILTER Interrupt 7 Mode select V7633 xx30 8 9 Input Circuit 10 IMPORTANT NOTE: In Pulse Output Mode, Y0 and Y1 references are redefined or are used differently in 11 two ways. Physical references refer to terminal screws, while logical references refer to I/O references in the ladder program. Please read the items below to understand this very crucial point. 12 Notice the I/O point assignment and usage in the above diagram: 13 • X0, X1, X2 and X3 can be filtered inputs or pulse inputs in Pulse Output Mode, and they are available as input contacts to the ladder program. • X1 behaves as an external interrupt to the pulse generator for automatic/step trapezoidal profiles. In 14 other profile modes, it can be used as a filtered input or pulse input just like X0 (registration mode configuration shown above). A • References “Y0” and “Y1” are used in two different ways. At the discrete output connector, Y0 and Y1 terminals deliver the pulses to the motion system. The ladder program uses logical references Y0 and Y1 to initiate “Start Profile” and “Load Position Value” HSIO functions in Mode 30. B Hopefully, the above discussion will explain why some I/O reference names have dual meanings in Pulse Output Mode. Please read the remainder of this section with care, to C avoid confusion about which actual I/O function is being discussed. D Y0 (Pulse / CW)
X1 during Automatic/Step Trapezoidal Profile
Y1 (Direction / CCW)
Y2 - Y17
X0, X1, X2, X3
X4 - X23
DL06 Micro PLC User Manual, 3rd Edition Rev. A
E–39