13 Step ladder diagram instruction
STL/RET step ladder diagram instruction
STL: step ladder diagram starts
RET: step ladder diagram ends
Content, range and data type
Parameter | Content | Range | Data type | Data type(Label) |
(d) | State assigns the number of destination step relay | 0 to 4,095 | bit | ANY_BOOL |
Device used
Instruction | Parameter | Device | Offset modification | Pulse expansion |
S | [D] | XXP | ||
STL | Parameter 1 | ● |
Features
① Programs that use step ladder diagram are based on the mechanical actions, and assign step relay S according to each process. It acts as a loop connected in the state contact (STL contact), and carries on the sequential control programming of input condition and output control.
② In step ladder diagram, consider step relay S as a control process and carries on the sequential control programming of input condition and output control. As the process operates, the previous process would be not executed. Therefore, the mechanical control could be performed by the simple sequential control of each process.
③ For a series of step ladder diagram, start with the initialization state, and program in the order of the states to be transferred.
Step ladder diagram exhibits relay ladder program, you could use state to program according to the flow of mechanical control. It could be thought of that state and relay are the same, which consist of drive coil and contact(STL contact).
Coil drives use SET instruction and OUT instruction, and contacts use STL instruction.
The internal loop actions connect to the status are as follows.
Internal loop action | |
ON execution | If the status is ON, the loop that connected to this outputs actions by STL. |
OFF execution (one operation cycle) | If the condition set in the transition of the state (transition condition) is satisfied, the next state is set to ON, and the state previous ON is turned OFF(reset). (Transition action) During state transition, only one operation cycle will both states be ON at the same time. After the transition, the state before the transition is turned OFF(reset) in the next operation cycle. Regardless of the state of the contact before the drive command, the drive instruction connected to the bus in the OFF state is only executed when it is OFF for one operation cycle (the same action as when the contact is OFF). However, when the transition state is used by the contact instruction, the contact image is turned OFF and executed after the transition condition is satisfied. |
No execution | After the next operation cycle that after OFF is executed, the action of OFF execution of the instruction is not performed. (jump state) |
The sequence chart of the state (internal loop)execution state is as below.
Each state has three functions of drive processing on the load, specifying the transition target, and specifying its transition conditions. As shown below, execute the drive processing on the load first, and then execute the sequential execution of the transfer processing. In the state without load, no drive processing is required
Step ladder programs execute the following actions
- It is recommended that contacts be programmed in the output drive.
- The output coil could be programmed repeatedly in different states.
- The OUT and SET instructions of stepping relay automatically reset the state before the transfer.
- It is not recommended to use the same stepping relay (S) number repeatedly
- Pointers(P) cannot be configured immediately after STL instruction. If configured, a program error occurs.
Key points
The action state of stepping relay set to be saved after power-off is backed up by the non-volatile memory. These stepping relays are used when a power failure occurs in the middle of the mechanical operation, and when the power is turned on again and you want to continue the operation from there. Besides, since these stepping relays keep operating even from RUN to STOP, when RUN is executed again, the operation will be restarted from the state before STOP.
- STL instruction can not be used in Interrupt routine, event routine and subroutine.
- When using STK instruction in interrupt routine, please do not use SET instruction or the driving state S of the OUT instruction.
- It is not that the use of jump instructions (CJ/CJP) in the state is prohibited. It is recommended to not use it as much as possible because it will cause complex actions.
✎Note: The pointer P could be set to the first instruction in STL without contacts, so the first instruction is regarded as irrelevant to the STL action below.
Device used
Device | Name | Content |
SM240 | Transfer prohibited | If SM240 is set ON, all the transfers between the states are prohibited. |
SM246 | STL operation | If SM247 and stepping relay ( device S ) are both ON, SM246 will be ON automatically. |
SM247 | STL valid monitoring | If SM247 is set to ON, the number of stepping relay in operating in stepping relay would be stored in SD240 to SD247 from least to most. |
SD240 to SD247 | ON stepping relay number | The number of the stepping relay to be ON is stored in SD240 to SD247 (up to 8)from least to most. |
✎Note:
Stepping relay(S) without setting lock is cleared by turning the power ON to OFF and RUN to STOP. If the power is turned ON to OFF and RUN to STOP while the status is valid, the process cannot be restarted from the middle.
Error code
No errors.
Program
Open M2, state relay S1is set to ON,the programs in STL S1 are executed normally.
Open M4, if S1 is ON, the state S11/S12 can be selected for transition according to the OFF/ON of M7, and the state S1 can be reset.
When M7 is OFF, transfer to S11
When M7 is ON, transfer to S12
IST/Initialization state
In the program that using stepping ladder diagram, the initialization state and special relays are automatically controlled.
Stepping ladder diagram program
Content, range and data type
Parameter | Content | Range | Data type | Data type(label) |
(s) | Start bit device number of the run mode switch | -- | bit | ANYBIT_ARRAY (element number: 8) |
(d1) | The minimum state number of the useful state in automatic mode ((d1)<(d2)) | -- | bit | ANY_BOOL |
(d2) | The maximum state number of the useful state in automatic mode ((d1)<(d2)) | -- | bit | ANY_BOOL |
EN | Execution condition | -- | bit | BOOL |
ENO | Execution result | -- | bit | BOOL |
Device used
Instruction | Parameter | Device | Offset modification | Pulse expansion | |||||
X | Y | M | S | SM | D.b | [D] | XXP | ||
IST | (s) | ● | ● | ● | ● | ● | |||
(d1) | ● | ||||||||
(d2) | ● |
Only device S could be used.
Features
(1) IST
1) Specify the start input of run mode in (s).
2) The switch for selecting the run mode occupies 8 points from the start bit device.
3) The device specified by the switch for selecting the run mode.The switch functions in the following table and X20 are separately assigned to the devices specified by the switch for selecting the run mode. Under the circumstances, to prevent X20 to X24 from being ON at the same time, a rotary switch must be used. Switches that are not in use need no wiring. However, these switches cannot be used for other purposes because they are occupied by IST instructions,
Source address | Device number (example) | Switch function | Content |
(s) | X20 | Individual run | Uses each button to turn the each load on or off. |
(s)+1 | X21 | Origin reset | Press the origin reset button to automatically return the machine to the origin. |
(s)+2 | X22 | Stepping | Each time the start button is pressed, it advances one process. |
(s)+3 | X23 | Cycle run once | If the start button is pressed at the origin, it will stop at the origin after executing one cycle of automatic operation. If the stop button is pressed in the middle, the process will be stopped, and if the start button is pressed again, the operation will continue from there, and then automatically stop at the origin. |
(s)+4 | X24 | continuous run | If the start button is pressed at the origin position, continuous repeated run starts. If the stop button is pressed, the run will stop after reaching the origin. |
(s)+5 | X25 | Start origin reset | Uses each button to turn the each load on or off. |
(s)+6 | X26 | Start automatically | Start stepping, cycle run once, continuous run |
(s)+7 | X27 | Stop | Stop run |
4) he minimum state number of the useful state in (d1).(automatic mode)
5) The maximum state number of the useful state in (d2).(automatic mode)
6) When the instructions are When the instruction input is ON, the following devices are automatically switched and controlled. It does not change when the instruction input is OFF.
Device number | Content | ON/OFF condition | |
SM240 | Transfer prohibited | ON condition | Always ON during individual run Always ON Except that when the start button is pressed during stepping When the stop button is pressed during origin reset and cycle run once. |
OFF condition | When the start button is pressed during stepping. After the stop button is pressed during origin reset and cycle run once. | ||
SM241 | Start transfer | ON condition | When the start button is pressed during origin reset and cycle run once. After the start button is pressed during continuous run |
OFF condition | When it is from RUN to STOP Always ON during individual run and origin reset After the stop button is pressed during continuous run | ||
SM242 | Start pulse | ON condition | Only at the moment when the start button is pressed |
OFF condition | Except when it is ON | ||
SM243 | Origin reset completion | ON condition | When the origin reset is completed (user program) |
OFF condition | When it is from RUN to STOP When the origin reset is not completed | ||
SM244 | Origin condition | ON condition | When the origin condition is satisfied (user program) |
OFF condition | When it is from RUN to STOP When origin reset is not completed | ||
SM245 | All the output reset prohibited | ON condition | When not executing all the output resets (user program) |
OFF condition | When executing all the output resets (user program) | ||
SM246 | STL state ON | ON condition | When STL monitoring valid is ON and any of the stepping relay(device S) is ON |
OFF condition | When STL monitoring valid is OFF, or when STL monitoring valid is ON and all the stepping relays(device S) are ON | ||
SM247 | STL monitoring valid | ON condition | When issuing IST instruction |
OFF condition | When stepping ladder diagram ends(user program) |
Device number | Content | ON/OFF condition | |
S0 | Initialization state of individual run | ON condition | When it is individual mode |
OFF condition | Except the individual mode | ||
S1 | Initialization state of origin state | ON condition | When it is origin reset mode |
OFF condition | Except the origin reset mode | ||
S2 | Initialization state of automatic run | ON condition | When it is automatic run mode |
OFF condition | Except the automatic run mode |
7) Do not program the following states as normal states.
Device number | Content | ON/OFF condition | |
S0 to S9 | Occupied as initialization state ✎S0 to S2 are used for individual run, origin reset and automatic run. ✎S3 to S9 could be used freely. | ON condition | When the step relay (S device) is selected as the initialization state. |
OFF condition | When the step relay (S device) is not selected | ||
S10 to S19 | Occupied as origin reset | ON condition | When the step relay (S device) is selected as the origin reset. |
OFF condition | When the step relay (S device) is not selected |
8) When origin reset completion(SM243) is not ON, if switching between individual run(X20), origin reset(X21) and automatic run(X22,X23,X24), then all the output would be OFF. Automatic operation could be restarted after origin reset completion.
✎Note:
- Mode selection switches don’t need to be all used. Unused switches should be set to empty (cannot be used for other purposes). It is necessary to write the program of the IST instruction before a series of STL loops such as states S0 to S2.
- S10 to S19 should be used for the state of the origin reset operation. In the final state of the origin reset operation, self-reset should be performed after SM243 is set
- Only one IST instruction can be written in the program.
(2) IST instruction equivalent loop
1) The details of the special relay (SM) and initialization state (S0 to S9) that are automatically controlled by the IST instruction are shown in the following equivalent circuit. (Please read it as a reference.) This equivalent circuit could not be programmed.
2) If the mode is switched between each, origin reset and automatic, when the machine is outside the origin position, all the outputs (output (Y) not driven by state and output (Y) driven by status by OUT and SET instructions) and the old state are reset in batches. The SM245 drive does not reset all outputs
(3) The example of importing IST instruction(workpiece transfer equipment)
Run mode
Run mode | Operations | |
Manual | Individual run | Uses each button to turn the each load on or off. |
Origin reset | Press the origin reset button to automatically return the machine to the origin. | |
Automatic | Stepping | Each time the start button is pressed, it advances one process. |
Cycle once | If the start button is pressed at the origin, it will stop at the origin after executing one cycle of automatic operation. If the stop button is pressed in the middle, the process will be stopped, and if the start button is pressed again, the operation will continue from there, and then automatically stop at the origin. | |
Continuous run | If the start button is pressed at the origin position, continuous repeated run starts. If the stop button is pressed, the run will stop after reaching the origin. |
Transfer equipment
1) To use IST instructions, mode inputs need to be assigned consecutive number inputs as shown below. When the numbers are not consecutive or a part of the mode is omitted, use the auxiliary relay to change the arrangement as shown in the figure below, and use it as the start input for mode specification.
Input device | X20 | X21 | X22 | X23 | X24 | X25 | X26 | X27 |
Assignment | Individual run | Origin reset | Stepping | Cycle run once | Continuous run | Origin reset start | Automatic start | Stop |
In this example, M0 is used as the start input for mode specification.
2) The special relay (SM) used in the IST instruction has different classifications. One is that the instruction itself is automatically controlled according to the situation and the other needs to be controlled by the program according to the preparation for operation and the purpose of control.
Special relay | Content | Remark |
SM240 (Transfer prohibited) | Once the special relay is in operation, all the state transfers are prohibited. Individual: SM240 continues operating. Origin reset and cycle once: After pressing the stop button, the operation is held until the start button is pressed. Stepping: SM240 continues operating, but only when the start button is pressed, it does not operate and the transfer is executed. When switching STOP to RUN, the operation of programmable controller is held, and unlocked when the start button is pressed. Even when the transfer state is prohibited, the output in the state continues the origin operation. | IST instructions execute automatic control |
SM241 (Start transfer) | An auxiliary relay as a transition condition from the initialization state S2 to the next state. Individual and origin reset: No operation. Stepping and cycle once: Only operates when the start button is pressed. Continuous: The operation is held when the start button is pressed, and unlocked after pressing the stop button. | |
SM242(Start pulse) | Only operates at the moment of pressing the start button. | |
SM247 (STL monitoring valid) | After using the IST instruction, set SM247 to ON.When SM247 turns ON, the STL monitoring becomes valid, and the status numbers (S0 to S899) in operation are stored in the special registers SD240 to SD247 in ascending order. Therefore, a maximum of eight operation states number can be monitored Besides, if any of there states is in operation, special relay SM246 also operates. | |
SM243 (Origin reset completion) | In origin reset mode, when the machine returns to the origin, operates the special relay (SM) with the user program. | Driven by sequential control program |
SM244 (Origin condition) | The special relay should be driven after detecting the origin condition of the machine. It is valid signal in all the modes. | |
SM245 (All the output reset prohibited) | If switching between individual run, origin reset and automatic mode, when the machine is not in the origin, reset all the outputs and operation states. But if SM245 is driven first, then only the operation state is reset. |
Program
3) When the machine is running, it could switch freely in "Automatic" mode (stepping/cycle once/continuous). In this case, to be safe, the switched mode becomes effective only after all outputs are reset once.(When SM245 (all the output reset prohibited) is set to ON, it will not be reset)
- No programming is required if there is no individual run mode.
4) No programming is required if there is no origin reset mode. But before automatic run, You need to reset the origin first to complete the SM243 set once
5) Automatic run (stepping/cycle once/continuous)
Error code
Error code | Content |
4085H | When the device number specified by (d1) and (d2) is in the following case. (d1)>(d2) |
When the device specified in (s) couldn’t reserve eight points. |