HIGH-SPEED INPUT AND PULSE OUTPUT FEATURES A PPENDIX E In This Chapter: Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .E–2 Choosing the HSIO Operating Mode . . . . . . . . . . . . . . . . . . . . . . . .E–4 Mode 10: High-Speed Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . .E–6 Mode 20: Quadrature Counter . . . . . . . . . . . . . . . . . . . . . . . . . . .E–18 Mode 30: Pulse Output . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix E: High-speed Input and Pulse Output Features 1 Introduction Built-in Motion Control Solution 2 Many machine control applications require various types of simple high-speed monitoring and control. These applications usually involve some type of motion 3 control, or high-speed interrupts for time-critical events. The DL05 Micro PLC solves this traditionally expensive problem with built-in CPU enhancements. Let’s take a closer look at the available high-speed I/O features.
Appendix E: High-speed Input and Pulse Output Features Dedicated High- Speed I/O Circuit The internal CPU’s main task is to execute the ladder program and read/write all I/O points during each scan. In order to service high-speed I/O events, the DL05 includes a special circuit which is dedicated to a portion of the I/O points. Refer to the DL05 block diagram in the figure below.
Appendix E: High-speed Input and Pulse Output Features 1 Choosing the HSIO Operating Mode Understanding the Six Modes 2 The High-Speed I/O circuit operates in one of the 6 basic modes as listed in the table below. The number in the left column is the mode number (later, we’ll use these numbers to configure the PLC). Choose one of the following modes according to the primary function 3 D E 6 7 8 9 10 11 1 1 14 A B C D E–4 you want from the dedicated High-Speed I/O circuit.
Appendix E: High-speed Input and Pulse Output Features Configuring the HSIO Mode If you have chosen a mode suited to the high-speed I/O needs of your application, we’re ready to proceed to configure the PLC to operate accordingly. In the block diagram below, notice the V-memory detail in the expanded CPU block. V-memory location V7633 determines the functional mode of the high-speed I/O circuit.
Appendix E: High-speed Input and Pulse Output Features 1 Mode 10: High-Speed Counter Purpose 2 The HSIO circuit contains one high-speed counter. A single pulse train from an external source (X0) clocks the counter on each signal leading edge. The counter counts only upwards, from 0 to 99999999. The counter compares the current count with up to 24 preset values, 3 D E 6 7 8 9 10 11 1 1 14 A B C D which you define.
Appendix E: High-speed Input and Pulse Output Features Wiring Diagram A general wiring diagram for counters/encoders to the DL05 in HSIO Mode 10 is shown below. Many types of pulse-generating devices may be used, such as proximity switches, single-channel encoders, magnetic or optical sensors, etc. Devices with sinking outputs (NPN open collector) are probably the best choice for interfacing. If the counter sources to the inputs, it must output 12 to 24 VDC.
Appendix E: High-speed Input and Pulse Output Features Setup for Mode 10 1 2 3 Recall that V7633 is the HSIO Mode Select register. Refer to the diagram below. Use BCD 10 in the lower byte of V7633 to select the High-Speed Counter Mode. The DL05 does not use bits 8 - 12, 14 and 15 in V7633. Memory Location V7633 Bits 0 14 0 13 0 12 11 0 0 D E 6 7 8 9 10 11 1 1 14 A B C D 15 0 10 9 0 0 8 0 7 0 0 For the function of bits 8 - 15, refer 3-5. refertotopage page E-5.
Appendix E: High-speed Input and Pulse Output Features Preset Data Starting Location Preset Table Pointer V7630 is a pointer location which points to the beginning of the Preset Data Table. The default starting location for the Preset Data Table is V2320 (default after initializing scratchpad V-memory). However, you may change this by programming a different value in V7630. Use the LDA and OUT instructions as shown: LDA O2000 Load the octal address, convert to hex, leave result in accumulator.
Appendix E: High-speed Input and Pulse Output Features 1 2 3 D Calculating Your Preset Values The preset values occupy two data words each. They can range in value from 0000 0000 to 9999 9999, just like the high-speed counter value. All 24 values are absolute values, meaning that each one is an offset from the counter zero value. The preset values must be individually derived for each application. In the industrial lathe diagram below, the PLC monitors the position of the lead screw by counting pulses.
Appendix E: High-speed Input and Pulse Output Features Input Options Input Configuration Register Function Hex Code Required X0 V7634 Counter Clock X1 V7635 Counter Reset (with interrupt) 0001 xx06, xx = filter time 0 - 99 ms (BCD) 0007* (default) 0207* 0107* 0307* Filtered Input xx06, xx= filter time 0 - 99 ms (BCD) Filtered Input Counter Reset (no interrupt) X2 V7636 D *With the counter reset, you have the option of a normal reset or a faster reset.
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 E–12 The next figure shows how the HSIO counter will appear in a ladder program. Note that the Enable Interrupt (ENI) command must execute before the counter value reaches the first preset value. We do this at powerup by using the first scan relay. When using the counter but not the presets and interrupt, we can omit the ENI.
Appendix E: High-speed Input and Pulse Output Features Program Example (cont’d) 1 2 3 DirectSOFT Direct SOFT32 First Scan Only SP0 Load constant K10 into the accumulator. This selects Mode 10 as the HSIO mode. LD K10 Mode 10 OUT V7633 D Load the constant required to configure X0 as the counter clock. LD K1 OUT V7634 Configure Inputs Output the constant K10 to V7633, the location of HSIO Mode select register.
Appendix E: High-speed Input and Pulse Output Features Counter With Presets Program Example 1 2 3 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.
Appendix E: High-speed Input and Pulse Output Features Load the constant Kffff into the accumulator. This value represents the end of the preset list. 1 2 3 Output the accumulator contents to the memory location for preset 4 (end of preset marker). D Load the preset C value into the accumulator. LDD K4850 Output the accumulator contents to the memory location for preset 3. OUTD V2324 LDD Kffff OUTD V2326 SP1 UDC CT76 SP1 Kxxxxxxxx CT76 is the HSIO counter.
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 E–16 Counter With Preload Program Example The following example shows how you can preload the current count with another value. When the preload command input (X4 in this example) is energized, we disable the counter from counting with C0. Then we write the value K3000 to the count register (V1076V1077). We preload the current count of the counter with K3000.
Appendix E: High-speed Input and Pulse Output Features Troubleshooting Guide for Mode 10 If you’re having trouble with Mode 10 operation, please study the following symptoms and possible causes. The most common problems are listed below. Symptom: The counter does not count. Possible causes: 1. Field sensor and wiring – Verify that the encoder, proximity switch, or counter actually turns on and illuminates the status LED for X0. The problem could be due to sinking-sourcing wiring problem, etc.
Appendix E: High-speed Input and Pulse Output Features 1 Mode 20: Quadrature Counter Purpose 2 The counter in the HSIO circuit can count two quadrature signal pulses instead of a single pulse train (mode 10 operation). Quadrature signals are commonly generated from incremental encoders, which may be rotary or linear. The quadrature counter has two ranges 3 D E 6 7 8 9 10 11 1 1 14 A B C D from 0 to 99999999 or -8388608 to 8388607.
Appendix E: High-speed Input and Pulse Output Features Wiring Diagram A general wiring diagram for encoders to the DL05 in HSIO Mode 20 is shown below. Encoders with sinking outputs (NPN open collector) are probably the best choice for interfacing. If the encoder sources to the inputs, it must output 12 to 24 VDC. Note that encoders with 5V sourcing outputs will not work with DL05 inputs.
Appendix E: High-speed Input and Pulse Output Features 1 2 3 Setup for Mode 20 Recall that V7633 is the HSIO Mode Select register. Refer to the diagram below. Use BCD 20 in the lower byte of V7633 to select the High-Speed Counter Mode. The DL05 does not use bits 8 - 12, 14 and 15 in V7633.
Appendix E: High-speed Input and Pulse Output Features Writing Your Control Program You may recall that the Up-Down counter instruction is standard in the DL05 instruction set. Refer to the figure below. The mnemonic for the counter is UDC (up-down counter). The DL05 can have up to 128 counters, labeled CT0 through CT177. The quadrature counter in the HSIO circuit is accessed in ladder logic by using UDC CT76.
Appendix E: High-speed Input and Pulse Output Features 1 2 3 Program Example (cont’d) DirectSOFT SP0 Select Mode 20 D E 6 7 8 9 10 11 1 1 14 A B C D Load constant K20 into the accumulator. This selects Mode 20 as the HSIO mode. LD K20 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.
Appendix E: High-speed Input and Pulse Output Features Counter Preload Program Example 1 2 3 To preload the counter, just add the following example rungs to the program above. X4 C0 RST Preload counter Load the BCD value K3000 into the accumulator. LDD K3000 Output the constant to V1076/V1077, the location of the accumulated pulse count. OUTD V1076 C0 C1 When the preload request is made, the user turns on X4. First we disable counting by resetting C0, the counter ’s enable input.
Appendix E: High-speed Input and Pulse Output Features 1 Mode 30: Pulse Output Purpose 2 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 3 D E 6 7 8 9 10 11 1 1 14 A B C D E–24 Trapezoidal Profile Velocity increment) and direction signals which you can connect to motor drive systems and perform various types of motion control.
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.
Appendix E: High-speed Input and Pulse Output Features 1 2 3 Wiring Diagram The generalized wiring diagram below shows pulse outputs Y0 and Y1 connected to the drive amplifier inputs of a motion control system. D E 6 7 8 9 10 11 1 1 14 A B C D E–26 + Signal Common Motor +24 VDC – Amplifier Pulse Direction Pulse Output Wiring Power Input Interfacing to Drive Inputs The pulse signals from Y0 and Y1 outputs will typically go to drive input circuits as shown above.
Appendix E: High-speed Input and Pulse Output Features Motion Control Profile Specifications 1 2 3 The motion control profiles generated in Pulse Output Mode have the following specifications: Motion Control Profile Specifications Parameter Specification Trapezoidal – Accel Slope / Target Velocity / Decel Slope Registration – Velocity to Position Control on Interrupt Velocity Control – Speed and Direction only –8388608 to 8388607 Absolute / relative command 40 Hz to 7 kHz V2320 to V2325 (Profile Paramet
Appendix E: High-speed Input and Pulse Output Features 1 2 3 Setup for Mode 30 Recall that V7633 is the HSIO Mode Select register. Refer to the diagram below. Use BCD 30 in the lower byte of V7633 to select the High-Speed Counter Mode. The DL05 does not use bits 8 - 12, 14 and 15 in V7633.
Appendix E: High-speed Input and Pulse Output Features Profile Parameter Table Profile Table Pointer V7630 is a pointer location which points to the beginning of the Profile Parameter Table. The default starting location for the profile parameter table is V2320. However, you may change this by programming a different value in V7630. Remember to use the LDA (load address) instruction, converting octal into hex.
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 E–30 Choosing the Profile Type Pulse Output Mode generates three types of motion profiles. Most applications use one type for most moves. However, each move can be different if required.
Appendix E: High-speed Input and Pulse Output Features Trapezoidal Profile Operation Trapezoidal Profile Applications The trapezoidal profile is best suited for simple point-to-point moves, when the target position is known in advance. Starting velocities must be within the range of 40 pps to 1k pps. The remainder of the profile parameters are in the profile parameter table.
Appendix E: High-speed Input and Pulse Output Features 1 2 3 Trapezoidal Profile Program Example The 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.
Appendix E: High-speed Input and Pulse Output Features Program Example (cont’d) SP0 SP0 Profile/Target Profile/Target Velocity Velocity Target Position Target Position Starting Velocity Starting Velocity Load the constant K100 which is required to select Load the constant which is requiredand to select Trapzoidal Profile,K100 absolute positioning, a target Trapzoidal velocity of Profile, 1 kHz. absolute positioning, and a target velocity of 1 kHz.
Appendix E: High-speed Input and Pulse Output Features 1 Registration Profile Operation Registration Applications 2 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 3 area of the work-piece allow a machine tool to D E 6 7 8 9 10 11 1 1 14 A B C D E–34 Finished part area Scrap Area register its position relative to the rectangle, to direction of motion drill properly. Registration marks 2.
Appendix E: High-speed Input and Pulse Output Features Registration Profile Program Example The registration 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. Registration Profile Velocity Target V elocity = 1 kHz Accel = 2 sec D Decel = 4 sec Starting Velocity = 40 Time Start position Target position = 5000 The following program will realize the profile drawn above, when executed.
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 E–36 Program Example (cont’d) SP0 Profile / Target Velocity Target Position Load the constant K9100 which is required to select Registration Profile, relative positioning, and a target velocity of 1 kHz (9xxx times 10 pps). LD K9100 OUT V2320 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).
Appendix E: High-speed Input and Pulse Output Features Home Search Program Example 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.
Appendix E: High-speed Input and Pulse Output Features 1 2 3 D Profile / Target Velocity SP0 LD K9100 Select Registration Profile, relative positioning, and a target velocity of 1000 pps (9xxx times 10 pps). OUT V2320 Starting Velocity C1 TMR T0 K5 T0 The constant K4 selects a starting velocity of 40 Hz (4 x 10 pps). LD K4 CCW past home E 6 7 8 9 10 11 1 1 14 A B C D E–38 OUT V2323 Acceleration C2 C3 X2 The constant K20 selects an acceleration time of 2 seconds (20 x 100 ms).
Appendix E: High-speed Input and Pulse Output Features Velocity Profile Operation Velocity Profile Applications 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. Velocity 1 2 3 D Time Start Y0 Profile Complete SP104 The time line of signal traces below the profile indicates the order of events.
Appendix E: High-speed Input and Pulse Output Features 1 2 3 Velocity Profile Program Example 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 D E 6 7 8 9 10 11 1 1 14 A B C D E–40 Time The following program uses dedicated discrete inputs to load in new velocity values.
Appendix E: High-speed Input and Pulse Output Features Program Example (cont’d) SP0 Profile / Target Velocity Select Direction LD K2000 OUT V2320 LDD K80000000 OUTD V2321 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 V2320, the location of the Profile Select setup register . Load the constant K80000000 which selects CCW direction for Velocity Profiles.
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 E–42 Pulse Output Error Codes The Profile Parameter Table starting at V2320 (default location) defines the profile. Certain numbers will result in a 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 V2326. Most errors can be corrected by rechecking the Profile Parameter Table values.
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.
Appendix E: High-speed Input and Pulse Output Features 1 Mode 40: High-Speed Interrupts Purpose 2 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: 3 • An external event needs to trigger an interrupt subroutine in the CPU. Using immediate I/O instructions in the subroutine is typical.
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 the High-Speed Counter Mode. The DL05 does not use bits 8 - 12, 14 and 15 in V7633.
Appendix E: High-speed Input and Pulse Output Features External Interrupt Timing Parameters 1 2 3 Signal pulses at X0 must meet certain timing criteria to guarantee an interrupt will result. Refer to the timing diagram below. The input characteristics of X0 are fixed (it is not a programmable filtered input). 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.
Appendix E: High-speed Input and Pulse Output Features External Interrupt Program Example The following program selects Mode 40, then selects the external interrupt option. Inputs X1 and X2 are configured as filtered inputs with a 10 ms time constant. The program is otherwise generic, and may be adapted to your application. DirectSOFT SP0 Mode 40 External Interrupt Filtered Inputs Load constant K40 into the accumulator. This selects Mode 40 as the HSIO mode.
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 E–48 Timed Interrupt Program Example 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, and X2, 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.
Appendix E: High-speed Input and Pulse Output Features Mode 50: Pulse Catch Input Purpose The HSIO circuit has a pulse-catch mode of operation. It monitors the signal on input X0, 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 current scan time. The HSIO circuit latches the input event on input X0 for one scan. This contact automatically goes off after one scan.
Appendix E: High-speed Input and Pulse Output Features 1 2 3 Setup for Mode 50 Recall that V7633 is the HSIO Mode Select register. Refer to the diagram below. Use BCD 50 in the lower byte of V7633 to select the High-Speed Counter Mode. The DL05 does not use bits 8 - 12,14 and 15 in V7633.
Appendix E: High-speed Input and Pulse Output Features Pulse Catch Program Example The following program selects Mode 50, then programs the pulse catch code for X0. Inputs X1 and X2 are configured as filtered inputs with 10 and 30 ms time constants respectively. The program is otherwise generic, and may be adapted to your application. DirectSOFT SP0 Load constant K50 into the accumulator. This selects Mode 50 as the HSIO mode.
Appendix E: High-speed Input and Pulse Output Features 1 Mode 60: Discrete Inputs with Filter Purpose 2 The last mode we will discuss for the HSIO circuit is Mode 60, Discrete Inputs with Filter. The purpose of this mode is to allow the input circuit to reject narrow pulses and accept wide ones, as viewed from the ladder program. This is useful in especially noisy environments or 3 D E 6 7 8 9 10 11 1 1 14 A B C D E–52 other applications where pulse width is important.
Appendix E: High-speed Input and Pulse Output Features Setup for Mode 60 Recall that V7633 is the HSIO Mode Select register. Refer to the diagram below. Use BCD 60 in the lower byte of V7633 to select the High-Speed Counter Mode. The DL05 does not use bits 8 - 12,14 and 15 in V7633.
Appendix E: High-speed Input and Pulse Output Features 1 2 3 Filtered Inputs Program Example The following program selects Mode 60, then programs the filter delay time constants for inputs X0, X1, and X2. Each filter time constant is different, for illustration purposes. The program is otherwise generic, and may be adapted to your application. DirectSOFT SP0 D E 6 7 8 9 10 11 1 1 14 A B C D E–54 Load constant K60 into the accumulator. This selects Mode 60 as the HSIO mode.