The text of a manual · part 31 of 38
DL06 Micro PLC User Manual, Volume 2 of 2, pages 300 to 309
Pages 300 to 309 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 300
Appendix E: High-speed Input and Pulse Output Features
Program Example 2: Automatic Trapezoidal Profile with External Interrupt
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D E–50
Registration Applications: 1. In a typical application shown to the right, product material in work moves past a work tool such as a drill. Registration marks on the scrap Finished part area Scrap Area area of the work-piece allow a machine tool to register its position relative to the rectangle, to drill properly. direction of motion Registration marks 2. In other examples of registration, the work piece is stationary and the tool moves. A drill bit may approach the surface of a part in work, preparing to drill a hole of precise depth. However, the drill bit length gradually decreases Detect contact due to tool wear. A method to overcome this is to detect the moment the drill makes contact with the surface of the part each time a part is drilled. The bit can then drill a constant depth after making contact with the part’s surface. 3. The home search move allows a motion system to calibrate its position on startup. In this case, the positioning system makes an indefinite move and waits for the load to pass by a home limit switch. This creates an interrupt at the moment when the load is in a known position. We then stop motion and preload the position value with a number which equates to the physical “home position”. When an interrupt pulse occurs on physical input X1, the starting position is declared to be the present count (current load position). The velocity control switches to position control, moving the load to the target position. Note that the minimum starting velocity is 40 pps. This instantaneous velocity accommodates stepper motors that can stall at low speeds. Registration Profile
Velocity
Target Velocity Accel
Decel
Starting Velocity Start position Start
Target position
Time
Y0
External Interrupt X1 Profile Complete
SP104
The time line of signal traces below the profile indicates the order of events. The CPU uses logical output Y0 to start the profile. Immediately the HSIO turns off the Profile Complete signal (SP104), so the ladder program can monitor the move’s completion by sensing the signal’s on state.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 301
Appendix E: High-speed Input and Pulse Output Features The Automatic Trapezoidal profile we want to perform is drawn and labeled in the following figure. It consists of a non-zero starting velocity, and moderate target velocity.
1 Automatic Trapezoidal Profile 2 Velocity Target V elocity = 1 kHz 3 Decel = 4 sec Accel = 2 sec Ending Velocity = Starting 80 Hz 4 Velocity = 40 Hz E Time Start position Target position = 5000 6 The following program will realize the profile drawn above, when executed. The first program rung contains all the necessary setup parameters. We only have to do this once in the 7 program, so we use first-scan contact SP0 to trigger the setup. 8 9 10 11 12 13 14 A B C D DirectSOFT 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 K2006 OUT V7634 OUT V7635 LD K1006
OUT V7636
OUT V7637
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 a 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 requires CCW and CW). Output this constant to V7637, configuring the pulse output type.
Load the constant K2006 which is required to select X0 and X1 as a filtered input with a 20 mS filter time constant. Output this constant to V7634, configuring X0.
Output this constant to V7635, configuring X1.
Load the constant K1006 which is required to select X2 and X3 as a filtered input with a 10 ms filter time constant.
Output this constant to V7636, configuring X2.
Output this constant to V7637, configuring X3.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
E–51
Page 302
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–52
SP0
Profile / Target Velocity Target Position
LD KF100 OUT V3630 LDD K5000 OUTD V3631
Starting Velocity
Start Profile X3
OUT V3637 Y0 SET
Y2 OUT C0 PD
C0
Output this constant to V3633, the location of the starting velocity parameter register.
Output this constant to V3634, the location of the acceleration parameter register.
Output this constant to V3635, the location of the deceleration parameter register. Load the constant K8 which is required to select an ending velocity of 80Hz (8 x 10 pps).
LD K8
Profile Complete SP104
Output this constant to V3631 and V3632, the location of the Target Position double-word register.
Load the constant K40 which is required to select a deceleration time of 4 seconds (40 x 100 mS).
LD K40 OUT V3635
Ending Velocity
Load the constant K5000 which selects a target position of 5000 pulses. Don’t forget to use double word size (8-digit BCD position value).
Load the constant K20 which is required to select an acceleration time of 2 seconds (20 x 100 mS).
LD K20 OUT V3634
Deceleration
Output this constant to V3630, the location of the Profile Select / StartingVelocity setup register.
Load the constant K4 which is required to select a starting velocity of 40 Hz (4 x 10 pps).
LD K4 OUT V3633
Acceleration
Load the constant KF100 which is required to select Automatic Trapezoidal Profile, relative positioning, with interrupt a velocity of 1 kHz (Fxxx times 10 pps).
Output this constant to V3637, the location of the ending velocity register.
We use an input to allow the operator to start the profile. X3 is a momentary Start switch. When the operator turns X3 ON, logical output Y0 starts the profile. SP104 is the logical output of the HSIO to indicate the move is complete. We use Y2 to energize an annunciator that the profile has finished. This won’t occur until after the interrupt from X1 has occurred and the profile is complete.
Y0 RST
The profile will begin when the start input (X3) is given. Then the motion begins an indefinite move, which lasts until an external interrupt on X1 occurs. Then the motion continues on for 5000 more pulses before stopping.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 303
Appendix E: High-speed Input and Pulse Output Features
Program Example 3: Automatic Trapezoidal Profile with Home Search One of the more challenging aspects of motion control is the establishment of actual position at powerup. This is especially true for open-loop systems which do not have a position feedback device. However, a simple limit switch located at an exact location on the positioning mechanism can provide “position feedback” at one point. For most stepper control systems, this method is a good and economical solution.
1 2 3 4 E 6 In the drawing above, the load moves left or right depending on the CW/CCW direction of motor rotation. The PLC ladder program senses the CW and CCW limit switches to stop the 7 motor, before the load moves out-of-bounds and damages the machine. The home limit switch is used at powerup to establish the actual position. The numbering system is arbitrary, 8 depending on a machine’s engineering units. At powerup, we do not know whether the load is located to the left or to the right of the 9 home limit switch. Therefore, we will initiate a home search profile, using the registration mode. The home limit switch is wired to X1, causing the interrupt. We choose an arbitrary initial search direction, moving in the CW (left-to-right) direction. 10 • If the home limit switch closes first, then we stop and initialize the position (this value is typically “0”, but it may be different if preferred). 11 • However, if the CW limit switch closes first, we must reverse the motor and move until the home limit switch closes, stopping just past it. 12 In the latter case, we repeat the first move, because we always need to make the final approach to the home limit switch from the same direction, so that the final physical position is the same 13 in either case! 14 A B C D Load
Positioning System
Limit Switches
Motion Numbering System
Motor
CCW limit (X0)
-3000
-2000
Home limit (X1)
-1000
0
LD K30
Mode 30
OUT V7633
Locate Parameter Table (optional)
LDA O3630
Selects Mode 30 as the HSIO mode.
3000
LD K103
OUT V7632
LD K2006 OUT V7634
Configure the address of the parameter table.
OUT V7635 LD K1006
OUT V7630
Select Pulse / Direction
2000
Filtered Inputs
Direct SOFT 5
SP0
1000
CW limit (X2)
Configure the Y0 and Y1 pulse outputs for pulse and direction, respectively.
OUT V7636 OUT V7637
The constant K2006 selects a 20 mS filter time constant.
Output this constant to V7634, configuring X0. Output this constant to V7635, configuring X1. The constant K1006 selects a 10 mS filter time constant.
Output this constant to V7630, configuring X2. Output this constant to V7637, configuring X3.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
E–53
Page 304
Appendix E: High-speed Input and Pulse Output Features Profile / Target Velocity
1 2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D
SP0
LD KD100 OUT V3630
Starting Velocity
Select Automatic Trapezoidal Profile, relative positioning, and a target velocity of 1000 pps (Dxxx times 10 pps).
C1
T0
The constant K4 selects a starting velocity of 40 Hz (4 x 10 pps).
LD K4
CCW past home OUT V3633
Acceleration
C2
C3
X1
The constant K20 selects an acceleration time of 2 seconds (20 x 100 mS).
LD K20
OUT V3635 X7
C10 SET
C0
We’ll choose the same for the deceleration value.
Target Position
C3
OUTD V3631 Y0 SET C0 SET
X1
E–54
C1
X2
C4
T1
Set C0 to indicate the CW home search has begun.
LDD K80000200 OUTD V3631 C1 SET
C3 SET
CCW past home Load a small positive position count (go CW).
Turn off Start Profile.
Y0 RST
Turn off Start Profile.
C4 SET
Go CW back to home. Add a timer to create a slight delay before reversing motor.
C5 SET
CW delay done.
Y0 SET
Start profile again.
Home Limit found, CW search direction C0 C1 C3 X1
Y0 RST
Start profile again.
TMR T1 K5
Turn on Start Profile, searching for either the home limit or the CW limit (depends on our starting position).
CW Limit found C0
Y0 SET
Home Limit found, CW search direction
Start the home search when X7 turns on.
The constant K50 selects a target position of 50 pulses (CW direction).
LDD K50
CCW delay done.
OUTD V3631
Search in CW direction C10
C2 SET
LDD K50
OUT V3634
Deceleration
Add a timer to create a slight delay before reversing motor.
TMR T0 K5
C5
The constant –K200 selects a target position of –200 pulses, which is in the CCW direction.
The CW limit has been reached.
Y0 RST
Turn off Start Profile.
LDD K0
Load the constant K0 for our initialized position.
OUTD V1174
Output this constant to V1174/V1175.
Y1 PD
The home search profile will execute specific parts of the program, based on the order of detection of the limit switches. Ladder logic sets C0 to initiate a home search in the CW direction. If the CW limit is encountered, the program searches for home in the CCW direction, passes it slightly, and does the final CW search for home. After reaching home, the last ladder rung preloads the current position to “0”.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 305
Appendix E: High-speed Input and Pulse Output Features
Step Trapezoidal Profile Operation With this step trapezoidal profile, you can control the acceleration and deceleration slopes as you want.
1 2 3 4 E 6 7 The time line of signal traces below the profile indicates the order of events. The HSIO uses logical output Y0 as the start input to the HSIO, which starts the profile. Immediately, the 8 HSIO turns off the Profile Complete signal (SP104), so the ladder program can monitor the progress of the move. Typically, a ladder program will monitor this bit so it knows when to 9 initiate the next profile move. You can also use the external interrupt (X1). Once the external interrupt feature selected for the profile, the DL06 keeps outputting the pulses until X1 turns on. Then the DL06 outputs the pulses defined as the target position. 10 Each acceleration and deceleration slope consists of 4 steps. You can set up the velocity and the distance (number of pulses) of each step. You don’t need to use all 4 steps of each slope. 11 For instance, if you want to use only 2 steps, just set zero to the velocity and the distance of the 3rd and 4th step. If the acceleration slope and the deceleration slope are identical, you can just put zero into all the velocity and the distance parameters for the deceleration slope. 12 13 14 A B C D Velocity (Hz)
Step Trapezoidal Profile
1000
Accel
800 600
Step 2
400
Step 1
200
Step 4
Step 3
Step 5
Decel Step 6 Step 7 Target position Step 8 Time
Start
External Interrupt (Optional)
Start position Y0
X1
SP104
Profile Complete
DL06 Micro PLC User Manual, 3rd Edition Rev. A
E–55
Page 306
Appendix E: High-speed Input and Pulse Output Features
1
Program Example 4: Step Trapezoidal Profile
2 3 4 E 6 7 8 9 10 11 12 13 14 A B C D E–56
Program Example
SP0
LD K30
Mode 30
OUT V7633
Locate Parameter Table
LDA O3630 OUT V7630
Select CW/CCW
LD K3 OUT V7632
Filtered Inputs
LD K2006 OUT V7634 LD K1006 OUT V7635
Load the octal address O3630 of the beginning of the Profile Parameter Table. Output this constant to V7630, the location of the pointer to the Profile Parameter Table. Load the constant K3 which is required to select CW and CCW for physical Y0 and Y1 functions. Output this constant to V7632, configuring pulse output type. Load the constant K2006 which is required to select X0 as a filtered input with a 20ms filter time constant. Output this constant to V7634, configuring X0.
Load the constant K1006 which is required to select X1 as a filtered input with a 10ms filter time constant. Output this constant to V7635, configuring X1.
Load the constant K1006 which is required to select X2 as a filtered input with a 10ms filter time constant.
OUT V7636
Output this constant to V7636, configuring X2.
LD K1006
Load the constant K1006 which is required to select X3 as a filtered input with a 10ms filter time constant.
LD K8100 OUT V3630
Target Position
Output this constant to V7633, the location of the . HSIO mode selection register.
LD K1006
OUT V7637
Profile/Target Velocity
Load the constant K30 which is required to select Mode 30 as the HSIO mode.
LDD K30000 OUTD V3631
Output this constant to V7637, configuring X3. Load the constant K8100 which is required to select trapezoidal profile, relative positioning, without interrupt and a target velocity of 1kHz. Output this constant to V3630, the location of the profile select/starting velocity setup register. Load the constant K30000 which selects a target position of 30000 pulses. 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.
Continued on next page
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 307
Appendix E: High-speed Input and Pulse Output Features Continued from previous page
Program Example
SP0
Step 1 Acceleration
Step 1 Distance
LD K20 OUT V3633 LD K100 OUT V3634
Step 2 Acceleration
LD K40 OUT V3635
Step 2 Distance
LD K200 OUT V3636
Step 3 Acceleration
LD K60 OUT V3637
Step 3 Distance
LD K300 OUT V3640
Step 4 Acceleration
LD K80 OUT V3641
Step 4 Distance
LD K400 OUT V3642
Step 5 Deceleration
LD K80 OUT V3643
Load the constant K20 which is required to select the step 1 acceleration velocity of 200 Hz. Output this constant to V3633, the location of the step 1 acceleration velocity setup register. Load the constant K100 which selects the step 1 distance of 100 pulses. Output this constant to V3634, the location of the step 1 distance. Load the constant K40 which is required to select the step 2 acceleration velocity of 400 Hz. Output this constant to V3635, the location of the step 2 acceleration velocity setup register. Load the constant K200 which selects the step 2 distance of 200 pulses. Output this constant to V3636, the location of the step 2 distance. Load the constant K60 which is required to select the step 3 acceleration velocity of 600 Hz. Output this constant to V3637, the location of the step 3 acceleration velocity setup register. Load the constant K300 which selects the step 3 distance of 300 pulses. Output this constant to V3640, the location of the step 3 distance. Load the constant K80 which is required to select the step 4 acceleration velocity of 800 Hz. Output this constant to V3641, the location of the step 4 acceleration velocity setup register. Load the constant K400 which selects the step 4 distance of 400 pulses. Output this constant to V3642, the location of the step 4 distance. Load the constant K80 which is required to select the step 5 deceleration velocity of 800 Hz. Output this constant to V3643 which is required to select the step 5 deceleration velocity of 800 Hz.
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–57
Page 308
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–58
Program Example
SP0
Load the constant K400 which selects the step 5 distance of 400 pulses.
LD K400
Step 5 Distance
Output this constant to V3644, the location of the step 5 distance.
OUT V3644
Step 6 Deceleration
Load the constant K60 which is required to select the step 6 deceleration velocity of 600 Hz.
LD K60
Output this constant to V3645, which is required to select the step 6 deceleration velocity of 600 Hz.
OUT V3645
Step 6 Distance
Load the constant K300 which selects the step 6 distance of 300 pulses.
LD K300
Output this constant to V3646, the location of the step 6 distance.
OUT V3646
Step 7 Deceleration
Load the constant K40 which is required to select the step 6 deceleration velocity of 400 Hz.
LD K40
Output this constant to V3647, which is required to select the step 6 deceleration velocity of 400 Hz.
OUT V3647
Step 7 Distance
Load the constant K200 which selects the step 7 distance of 200 pulses.
LD K200
Output this constant to V3650, the location of the step 7 distance.
OUT V3650
Step 8 Deceleration
Step 8 Distance
Start Profile
LD K20
Load the constant K20 which is required to select the step 8 deceleration velocity of 200 Hz.
OUT V3651
Output this constant to V3651, which is required to select the step 8 deceleration velocity of 200 Hz.
LD K100
Load the constant K100 which selects the step 8 distance of 100 pulses.
X3
X0
Profile / Target Velocity
Output this constant to V3652, the location of the step 8 distance.
OUT V3652 Y0 OUT
We use a spare filtered input to allow the operator to start the profile. When the operator turns X3 ON, then OFF, logical output Y0 starts the profile. Load value.
LDD K0
Output this constant to V1174/V1175 (CT174/CT175), the location of the current position value.
OUTD V1174 Y1 PD END
Turn on Y1 for 1 scan. The of-to-on transition causes the HSIO to preload the current position with the value in V1174/V1175.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 309
Appendix E: High-speed Input and Pulse Output Features
Velocity Profile Operation The velocity profile is best suited for applications which involve motion but do not require moves to specific points. Conveyor speed control is a typical example.
1 2 Velocity 3 4 E Time 6 Y0 Start 7 Profile SP104 Complete 8 The time line of signal traces below the profile indicates the order of events. Assuming the velocity is set greater than zero, motion begins when the Start input (Y0) energizes. Since 9 there is no end position target, the profile is considered in progress as long as the Start input remains active. The profile complete logical input to ladder logic (X0) correlates directly to the Start input status when velocity profiles are in use. 10 While the Start input is active, the ladder program can command a velocity change by writing a new value to the velocity register (V3633 by default). The full speed range of 40 Hz to 10 kHz is available. Notice from the drawing that there are no acceleration or deceleration ramps 11 between velocity updates. This is how velocity profiling works with the HSIO. However, the ladder program can command more gradual velocity changes by incrementing or 12 decrementing the velocity value more slowly. A counter or timer can be useful in creating your own acceleration/deceleration ramps. Unless the load must do a very complex move, it is 13 easier to let the HSIO function generate the accel/decel ramps by selecting the trapezoidal or registration profiles instead. 14 Unlike the trapezoidal and registration profiles, you must specify the desired direction of travel with velocity profiles. Load the direction select register (V3631/V3632 by default) with A 8000 0000 hex for CCW direction, or 0 for CW direction. B C D DL06 Micro PLC User Manual, 3rd Edition Rev. A
E–59