The text of a manual · part 32 of 38
DL06 Micro PLC User Manual, Volume 2 of 2, pages 310 to 319
Pages 310 to 319 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 310
Appendix E: High-speed Input and Pulse Output Features
Program Example 5: Velocity Profile
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D
The velocity profile we want to perform is drawn and labeled in the following figure. Each velocity segment is of indefinite length. The velocity only changes when ladder logic (or other device writing to V-memory) updates the velocity parameter. Velocity Profile Velocity
Time
The following program uses dedicated discrete inputs to load in new velocity values. This program is fun to try, because you can create an infinite variety of profiles with just two or three input switches. The intent is to turn on only one of X2, X3, or X4 at a time. The beginning of the program contains all the necessary setup parameters for Pulse Output Mode 30. We only have to do this once in the program, so we use first-scan contact SP0 to trigger the setup. Direct SOFT 5 SP0
LD K30
Mode 30
OUT V7633
Locate Parameter Table (optional)
LDA O3630 OUT V7630
Select Pulse / Direction
LD K103 OUT V7632
Filtered Inputs
LD K1006 OUT V7634 OUT V7635 OUT V7636 OUT V7637
E–60
Load constant K30 into the accumulator. This selects Mode 30 as the HSIO mode. Output this constant to V7633, the location of the HSIO Mode select register. Load the octal address of the beginning of the Profile Parameter Table. The LDA instruction converts this to hex number in the accumulator. Output this address to V7630, the location of the pointer to the Profile Parameter Table. Load the constant K103 which is required to select pulse and direction for physical Y0 and Y1 functions, respectively (Use K3 if your application needs CW and CCW). Output this constant to V7632, configuring the pulse output type. Load the constant K1006 which is required to select filtered inputs with a 10 mS filter time constant. Output this constant to V7634, configuring X0.
Output this constant to V7635, configuring X1.
Output this constant to V7636, configuring X2.
Output this constant to V7637, configuring X3.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 311
Appendix E: High-speed Input and Pulse Output Features
Program Example Cont’d
SP0
Profile / Target Velocity Select Direction
LD K2000 OUT V3630 LDD K80000000 OUTD V3631
Set Velocity
Load the constant K2000 which is required to select Velocity Profile. This data word contains no velocity information in the case of velocity mode. Output this constant to V3630, the location of the Profile Select setup register. Load the constant K80000000 which selects CCW direction for Velocity Profiles. Don’t forget to use double word size (8-digit BCD position value). Output this constant to V3631 and V3632, the location of the Target Position double-word register. Load the constant K10 which is required to select an initial velocity of 100 pps (uses x10 multiplier).
LD K10 OUT V3633
Output this constant to V3633, the location of the velocity parameter register. After the program is running, we can write here again, using discrete input switches.
Start Profile X1
Y0 OUT
Go Slow X2
LD K50 OUT V3633
We use a spare filtered input to allow the operator to start the profile. When the operator turns X1 ON and leaves it on, logical output Y0 starts the profile. Load the constant K50 which is required to select a velocity of 500 pps when the operator closes X2. Output this constant to V3633, the location of the velocity parameter register. The speed will change immediately.
Go Moderately X3
Go Fast X4
LD K200 OUT V3633 LD K600 OUT V3633
Load the constant K200 which is required to select a velocity of 2000 pps when the operator closes X3. Output this constant to V3633, the location of the velocity parameter register. The speed will change immediately. Load the constant K600 which is required to select a velocity of 6000 pps when the operator closes X4. Output this constant to V3633, the location of the velocity parameter register. The speed will change immediately.
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–61
Page 312
Appendix E: High-speed Input and Pulse Output Features
Automatic Trapezoidal Profile Error Codes
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D
The Profile Parameter Table starting at V3630 (default location) defines the profile. Certain numbers will result in an error when the HSIO attempts to use the parameters to execute a move profile. When an error occurs, the HSIO writes an error code in V3636. Most errors can be corrected by rechecking the Profile Parameter Table values. The error is automatically cleared at powerup and at Program-to-Run Mode transitions. Error Code 0000 0010 0011 0020 0021 0022 0030 0031 0032 0040 0041 0042 0050 0051 0052 0060 0061 0062 0070 0071 0072 0073
Error Description No error Requested profile type code is invalid (must use 4 to 6 or C to F) Interrupt is selected for absolute mode Target Velocity is not in BCD Target Velocity is specified to be less than 40 pps Target Velocity is specified to be greater than 10,000 pps Target Position value is not in BCD Target Position value is zero Direction Select is not 0 or 80000000. Starting Velocity is not in BCD Starting Velocity is specified to be less than 40 pps Starting Velocity is specified to be greater than 10,000 pps Acceleration Time is not in BCD Acceleration Time is zero Acceleration Time is greater than 10 seconds Deceleration Time is not in BCD Deceleration Time is zero Deceleration Time is greater than 10 seconds Ending Velocity is not BCD Ending Velocity is specified to be less than 40 pps Ending Velocity is specified to be greater than 1,000 pps Ending Velocity is specified to be greater than Target Velocity
Troubleshooting Guide for Mode 30 If you’re having trouble with Mode 30 operation, please study the following symptoms and possible causes. The most common problems are listed below:
Symptom: The stepper motor does not rotate.
E–62
Possible causes: 1. Configuration – Verify that the HSIO actually generates pulses on outputs Y0 and Y1. Watch the status LEDs for Y0 and Y1 when you start a motion profile. If the LEDs flicker on and off or are steadily on, the configuration is probably correct. 2. Programming error – If there are no pulses on Y0 or Y1 you may have a programming error. Check the contents of V3636 for an error code that may be generated when the PLC attempts to do the move profile. Error code descriptions are given above. 3. Check target value – The profile will not pulse if the count value is equal to the target value (ex. count =0, target=0).
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 313
Appendix E: High-speed Input and Pulse Output Features 4. Wiring – Verify the wiring to the stepper motor is correct. Remember the signal ground connection from the PLC to the motion system is required. 5. Motion system – Verify that the drive is powered and enabled. To verify the motion system is working, you can use Mode 60 operation (normal PLC inputs/outputs) as shown in the test program below. With it, you can manually control Y0 and Y1 with X0 and X1, respectively. Using an input simulator is ideal for this type of manual debugging. With the switches you can singlestep the motor in either direction. If the motor will not move with this simple control, Mode 30 operation will not be possible until the problem with the motor drive system or wiring is corrected. Direct SOFT 5 SP0
Load constant K60 into the accumulator. This selects Mode 60 as the HSIO mode.
LD K60
Mode 60
OUT V7633
Filtered Inputs
LD K1006 OUT V7634 OUT V7635 OUT V7636 OUT V7637
X0
X1
Output the constant to V7633, the location of the HSIO Mode select register. Load the constant K1006 which is required to configure filtered inputs with a time constant of 10 mS. Output this constant to V7634, configuring X0.
Output this constant to V7635, configuring X1.
Output this constant to V7636, configuring X2.
Output this constant to V7637, configuring X3.
Y0 OUT
Use a switch on X0 input to manually control output Y0.
Y1 OUT
Use a switch on X1 input to manually control output Y1.
END
END coil marks the end of the main program..
6. Memory Error – HSIO configuration parameters are stored in the CPU system memory. Corrupted data in this memory area can sometimes interfere with proper HSIO operation. If all other corrective actions fail, initializing the scratchpad memory may solve the problem. With DirectSOFT 5, select PLC > Setup > Initialize Scratch Pad from the Menu bar.
Symptom: The motor turns in the wrong direction. Possible causes: 1. Wiring – If you have selected CW and CCW type operation, just swap the wires on Y0 and Y1 outputs. 2. Direction control – If you have selected Pulse and Direction type operation, just change the direction bit to the opposite state.
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–63
Page 314
Appendix E: High-speed Input and Pulse Output Features
Mode 40: High-Speed Interrupts
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D
Purpose The HSIO Mode 40 provides a high-speed interrupt to the ladder program. This capability is provided for your choice of the following application scenarios: • External events need to trigger an interrupt subroutine in the CPU. Using immediate I/O instructions in the subroutine is typical. • An interrupt routine needs to occur on a timed basis which is different from the CPU scan time (either faster or slower). The timed interrupt is programmable, from 5 to 999 mS.
Functional Block Diagram
E–64
The HSIO circuit creates the high-speed interrupt to the CPU. The following diagram shows the external interrupt option, which uses X0. In this configuration X1, X2 and X3 are external interrupts or normal filtered inputs. DL06 PLC
Output Circuit Y0, Y1
Y2 -Y17
HSIO Interrupt
X0
I/O data
Interrupt or Filter
Interrupt Mode select
X1, X2, X3
CPU V-memory V7633
0040
X4 - X23
Input Circuit
Alternately, you may configure the HSIO circuit to generate interrupts based on a timer, as shown below. In this configuration, inputs X0 is a filtered input. DL06 PLC
Output Circuit Y0, Y1
HSIO Interrupt Timer Filter X0
Y2 - Y17
I/O data Interrupt or Filter
Interrupt Mode select
X1, X2, X3
Input Circuit
DL06 Micro PLC User Manual, 3rd Edition Rev. A
CPU V-memory V7633
0040
X4 - X23
Page 315
Appendix E: High-speed Input and Pulse Output Features
Setup for Mode 40 Recall that V7633 is the HSIO Mode Select register. Refer to the diagram below. Use BCD 40 in the lower byte of V7633 to select high-speed interrupts. Memory Location V7633 Bits
15
14
13
12 11
10
9
8
7
6
5
4
3
2
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
4
0
Miscellaneous Setup (BCD)
HSIO Mode Setup (BCD)
00 = Not Used (default) 10 = Battery Enabled 20 = Power-up in RUN 30 = Battery Enabled and Power-up in RUN
40 = High-Speed Interrupts
Choose the most convenient method of programming V7633 from the following: • Include load and out instructions in your ladder program • DirectSOFT 5’s memory editor • Use the Handheld Programmer D2–HPP
We recommend using the first method above so that the HSIO setup becomes an integral part of your application program. An example program later in this section shows how to do this.
Interrupts and the Ladder Program Refer to the drawing below. The source of the interrupt may be external (X0 - X3). An internal timer can be used instead of X0 as the interrupt source. The setup parameter in V7634 serves a dual purpose: • It selects between the two interrupt sources (external or internal timer). The timed interrupt can only be used with X0. • In the case of the timer interrupt, it programs the interrupt timebase between 5 and 999 mS.
The resulting interrupt uses label INT 0, 1, 2 or 3 in the ladder program. Be sure to include the Enable Interrupt (ENI) instruction at the beginning of your program. Otherwise, the interrupt routine will not be executed. CPU Scan Input Update Ladder Program Execution
X0, External Interrupt
Current Instruction
TIMER Interrupt source / Time select V7634
INT
Interrupt Routine Program IRT
Input Update xxx4
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D
X1-X3, External Interrupts
DL06 Micro PLC User Manual, 3rd Edition Rev. A
E–65
Page 316
Appendix E: High-speed Input and Pulse Output Features
External Interrupt Timing Parameters
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D
External interrupt signals must meet certain timing criteria to guarantee an interrupt will result. Refer to the timing diagram below. The minimum pulse width is 0.1 ms. There must be some delay before the next interrupt pulse arrives, such that the interrupt period cannot be smaller than 0.5 ms. 0.5 ms minimum 0.1 ms minimum External Interrupt
X0 Time
Timed Interrupt Parameters When the timed interrupt is selected, the HSIO generates the interrupt to ladder logic. There is no interrupt “pulse width” in this case, but the interrupt period can be adjusted from 5 to 999 ms. 5 ms to 999 ms Timed Interrupt Time
X Input / Timed INT Configuration
E–66
The configurable discrete input options for High-Speed Interrupt Mode are listed in the table below. Input X0 is the external interrupt when “0004” is in V7634. If you need a timed interrupt instead, then V7634 contains the interrupt time period, and input X0 becomes a filtered input (uses X1’s filter time constant by default). Inputs X0, X1, X2, and X3, can be filtered inputs, having individual configuration registers and filter time constants, interrupt inputs or counter inputs. Input
Configuration Register
X0
V7634
X1
V7635
X2
V7636
X3
V7637
Function
Hex Code Required
External Interrupt Timed Interrupt Interrupt Pulse Input Filtered Input Interrupt Pulse Input Filtered Input Interrupt Pulse Input Filtered Input
0004 (default) xxx4, xxx = INT timebase 5 - 999 ms (BCD) 0004 (default) 0005 xx06 (xx = filter time) 0 - 99 ms (BCD) 0004 (default) 0005 xx06 (xx = filter time) 0 - 99 ms (BCD) 0004 (default) 0005 xx06 (xx = filter time) 0 - 99 ms (BCD)
If you are only using one of the points for an interrupt, you may want to select a different main mode (i.e. 10, 20, 30, 50, or 60); and then, just configure one of the terminals not taken as an interrupt. For example, you might want to configure your CPU for the UP counter mode (Mode 10) and use point 03 for a high speed interrupt. You should read the individual sections for any alternate mode you might choose. There you will find instructions on how to select a high speed interrupt as a secondary feature. DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 317
Appendix E: High-speed Input and Pulse Output Features
Program Example 1: External Interrupt The following program selects Mode 40, then selects the external interrupt option for inputs X0 and X1. Inputs X2 and X3 are configured as filtered inputs with a 10 ms time constant. The program is otherwise generic, and may be adapted to your application. Direct SOFT 5 SP0
Load constant K40 into the accumulator. This selects Mode 40 as the HSIO mode.
LD K40
Mode 40
OUT V7633
External Interrupt
LD K4
Load the constant K4 which is required to select the external interrupt option. X0 is the interrupt input.
OUT V7634 OUT V7635
Filtered Inputs
LD K1006 OUT V7636 OUT V7637
INT Enable
Output this constant to V7633, the location of the HSIO Mode select register.
Output this constant to V7634, configuring the external interrupt option for X0. Output this constant to V7635, configuring the external interrupt option for X1. Load the constant K1006 which is required to select filtered inputs with a 10 mS filter time constant. Output this constant to V7636, configuring X2.
Output this constant to V7637, configuring X3.
Y5 RST
Reset output Y5.
Y6 RST
Reset output Y6.
ENI
Enable Interrupts at the beginning of the program. Insert Main Program rungs here for your application.
Main Program
INT
END
The INT label marks the beginning of the interrupt service routine program.
O0
Interrupt Routine SP1
INT
END coil marks the end of the main program..
Insert interrupt service routine rungs here for your application.
Y5 SETI
Set output Y5
IRT
Return to the main ladder program.
O1
Interrupt Routine SP1
Insert interrupt service routine rungs here for your application.
Y6 SETI
Set output Y6.
IRT
Return to the main ladder 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–67
Page 318
Appendix E: High-speed Input and Pulse Output Features
Program Example 2: Timed Interrupt
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D E–68
The following program selects Mode 40, then selects the timed interrupt option, with an interrupt period of 100 ms. 100 ms Timed Interrupt Time
Inputs X0, X1, X2, and X3, are configured as filtered inputs with a 10 ms time constant. Note that X0 uses the time constant from X1. The program is otherwise generic, and may be adapted to your application. Direct SOFT5 SP0
Load constant K40 into the accumulator. This selects Mode 40 as the HSIO mode.
LD K40
Mode 40
OUT V7633
Timed Interrupt
LD K1004 OUT V7634
Filtered Inputs
LD K1006 OUT V7635 OUT V7636 OUT V7637
INT Enable
ENI
Output this constant to V7633, the location of the HSIO Mode select register. Load the constant K1004 which is required to select the timed interrrupt option, with a period of 100 mS. Output this constant to V7634, configuring the timed interrupt for 100 ms period. Load the constant K1006 which is required to select filtered inputs with a 10 ms filter time constant. Output this constant to V7635, configuring X1 and X0.
Output this constant to V7636, configuring X2.
Output this constant to V7637, configuring X3.
Enable Interrupts at the beginning of the program. Insert Main Program rungs here for your application.
Main Program END INT
The INT label marks the beginning of the interrupt service routine program.
O0
Insert interrupt service routine rungs here for your application.
Interrupt Routine SP1
END coil marks the end of the main program..
LD K1
Load constant K1 into the accumulator.
ADD V2000
Add the value in the accumulator with the value in memory location V2000.
OUT V2000
Output the result into memory location V2000.
IRT
Return to the main ladder program.
NOTE: X0 cann ot be used in the main program logic; however, using X0 to set C10, for instance, will allow the use of C10 in the main program logic. Do not forget to reset C10.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 319
Appendix E: High-speed Input and Pulse Output Features
Mode 50: Pulse Catch Input
1 The HSIO circuit has a pulse-catch mode of operation. It monitors the signal on inputs X0 2 X3, preserving the occurrence of a narrow pulse. The purpose of the pulse catch mode is to enable the ladder program to “see” an input pulse which is shorter in duration than the 3 current scan time. The HSIO circuit latches the input event on input X0 - X3 for one scan. This contact automatically goes off after one scan. 4 Functional Block Diagram Refer to the block diagram below. When the lower byte of HSIO Mode register V7633 contains a BCD “50”, the pulse catch mode in the HSIO circuit is enabled. X0 - X3 E automatically become the pulse catch inputs, which set the latch on each rising edge. The HSIO resets the latch at the end of the next CPU scan. Inputs X1 X2, and X3 can be filtered 6 discrete inputs, also. 7 8 9 10 11 12 Pulse Catch Timing Parameters Signal pulses at X0 - X3 must meet certain timing criteria to guarantee a pulse capture will result. Refer to the timing diagram below. The input characteristics of X0 are fixed (it is not a 13 programmable filtered input). The minimum pulse width is 0.1 ms. There must be some delay before the next pulse arrives, such that the pulse period cannot be smaller than 0.5 ms. 14 If the pulse period is smaller than 0.5 ms, the next pulse will be considered part of the current pulse. A 0.5 ms minimum 0.1 ms minimum B Pulse X0 Input C Time D NOTE: The pulse catch and filtered input functions are opposite in nature. The pulse catch feature seeks to Purpose
DL06 PLC
Output Circuit
Y2 -Y17
Y0, Y1
HSIO
Latch
Set
Reset
X0 scan
I/O data
Latch or Filter
CPU
V-memory
Mode select
X1, X2, X3
V7633 0050 X4 - X23
Input Circuit capture narrow pulses, while the filter input feature seeks to reject narrow pulses.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
E–69