13 Step ladder diagram instruction

Last modified by Stone Wu on 2022/08/01 07:34

STL/RET step ladder diagram instruction

STL: step ladder diagram starts

RET: step ladder diagram ends

13_html_1ebc646f4789caba.png

Content, range and data type

ParameterContentRangeData typeData type(Label)
(d)State assigns the number of destination step relay0 to 4,095bitANY_BOOL

Device used

InstructionParameterDevice

Offset modification

Pulse expansion

S[D]XXP
STLParameter 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.

13_html_36482a910ef0eac5.gif

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 executionIf 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 executionAfter 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.

13_html_d996d472c1ce5d44.gif

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

13_html_2e008aa6a244ae7e.gif

Step ladder programs execute the following actions

13_html_65cbca9b51b2217c.gif

  1. It is recommended that contacts be programmed in the output drive.
  2. The output coil could be programmed repeatedly in different states.
  3. The OUT and SET instructions of stepping relay automatically reset the state before the transfer.
  4. It is not recommended to use the same stepping relay (S) number repeatedly
  5. 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.

  1. STL instruction can not be used in Interrupt routine, event routine and subroutine.
  2. When using STK instruction in interrupt routine, please do not use SET instruction or the driving state S of the OUT instruction.
  3. 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.

13_html_dba26d70ca6d6ddf.gif

✎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

DeviceNameContent
SM240Transfer prohibitedIf SM240 is set ON, all the transfers between the states are prohibited.
SM246STL operationIf SM247 and stepping relay ( device S ) are both ON, SM246 will be ON automatically.
SM247STL valid monitoringIf 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 SD247ON stepping relay numberThe 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

13_html_e18dd8e05b5bbb36.png

IST/Initialization state

In the program that using stepping ladder diagram, the initialization state and special relays are automatically controlled.

13_html_2725ba6a9256465.png

Stepping ladder diagram program

Content, range and data type

ParameterContentRangeData typeData 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))--bitANY_BOOL
(d2)The maximum state number of the useful state in automatic mode ((d1)<(d2))--bitANY_BOOL
ENExecution condition--bitBOOL
ENOExecution result--bitBOOL

Device used

InstructionParameterDevice

Offset modification

Pulse expansion

XYMSSMD.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 functionContent
(s)X20Individual runUses each button to turn the each load on or off.
(s)+1X21Origin resetPress the origin reset button to automatically return the machine to the origin.
(s)+2X22SteppingEach time the start button is pressed, it advances one process.
(s)+3X23Cycle 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)+4X24continuous runIf 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)+5X25Start origin resetUses each button to turn the each load on or off.
(s)+6X26Start automaticallyStart stepping, cycle run once, continuous run
(s)+7X27StopStop 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 numberContentON/OFF condition
SM240Transfer prohibitedON 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.

SM241Start transferON 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

SM242Start pulseON conditionOnly at the moment when the start button is pressed
OFF conditionExcept when it is ON
SM243Origin reset completionON conditionWhen the origin reset is completed (user program)
OFF condition

When it is from RUN to STOP

When the origin reset is not completed

SM244Origin conditionON conditionWhen 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 conditionWhen not executing all the output resets (user program)
OFF conditionWhen executing all the output resets (user program)
SM246STL state ONON conditionWhen STL monitoring valid is ON and any of the stepping relay(device S) is ON
OFF conditionWhen STL monitoring valid is OFF, or when STL monitoring valid is ON and all the stepping relays(device S) are ON
SM247STL monitoring validON conditionWhen issuing IST instruction
OFF conditionWhen stepping ladder diagram ends(user program)
Device numberContentON/OFF condition
S0Initialization state of individual runON conditionWhen it is individual mode
OFF conditionExcept the individual mode
S1Initialization state of origin stateON conditionWhen it is origin reset mode
OFF conditionExcept the origin reset mode
S2Initialization state of automatic runON conditionWhen it is automatic run mode
OFF conditionExcept the automatic run mode

7) Do not program the following states as normal states.

Device numberContentON/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 conditionWhen the step relay (S device) is selected as the initialization state.
OFF conditionWhen the step relay (S device) is not selected
S10 to S19Occupied as origin resetON conditionWhen the step relay (S device) is selected as the origin reset.
OFF conditionWhen 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: 

  1. 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.
  2. 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
  3. 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.

13_html_99e609560da46061.gif

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

13_html_b4c1b1a6a939bc79.gif

(3) The example of importing IST instruction(workpiece transfer equipment)

Run mode

13_html_f814fecb839cc860.gif

Run modeOperations
ManualIndividual runUses each button to turn the each load on or off.
Origin resetPress the origin reset button to automatically return the machine to the origin.
AutomaticSteppingEach 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 runIf 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

13_html_3a954a32ec584e9b.gif

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 deviceX20X21X22X23X24X25X26X27
AssignmentIndividual runOrigin resetSteppingCycle run onceContinuous runOrigin reset startAutomatic startStop

13_html_21a483e7a1e9a5cc.gif

In this example, M0 is used as the start input for mode specification.

13_html_e3eb050bd3aa4d3f.gif

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 relayContentRemark

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)

13_html_a01525c79014ab77.gif

  1. No programming is required if there is no individual run mode.

13_html_792e02bae5815ad7.gif

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

13_html_512187f8478241a0.gif

5) Automatic run (stepping/cycle once/continuous)

13_html_8411c8555e38e3af.gif

Error code

Error codeContent
4085HWhen 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.