Topic: DMD0542

Help File Version: 2.10.0.636

SGSETI - Indexed Enable Stage


The Indexed Enable Stage (SGSETI) instruction is used to enable a specific stage within a contiguous range of stages. Unlike the Indexed Jump (JMPI) instruction, Indexed Enable Stage does NOT disable the current stage. The instruction uses the Index value to select one of the stages within that range, and then enable the selected stage. The Last / Exception Stage in the defined range is the error handling (exception) stage. Any time the Index value is not within the defined range of stages, the Last / Exception Stage will be selected.

 

For example, if the Index has a value of 7 and First Stage is S12 and Last / Exception Stage is S21, then the instruction would enable Stage S19 (S12 + 7). If the value in Index had been larger than the range created in the instruction (e.g. value of 11; S12 + 11 = S23) or a negative value, then the Last / Exception Stage is enabled (S21).

 

 

It is important to note that when this instruction is executed, it does NOT cause an immediate move to the target stage; it simply enables the target stage. The effect of this instruction will occur the next time the target stage is normally processed as part of the CPU's scan. This means if the target stage is "below" this stage in the Program, the target stage will execute on the same scan as the SGSETI instruction; if the target stage is "above" this stage in the Program, the target stage will execute on the scan following the SGSETI instruction.

 

Like all of the other stage programming instructions this one must be placed in a Program; stage instructions cannot be placed in a Task, a Subroutine, or an Interrupt Service Routine. Stage programming instructions can only reference stages in the same Program code block, they cannot reference stages in a different Program code block.

 

To switch between displaying the fully qualified stage reference ($Main.S0) and the abbreviated name (S0), go to the View -> Options -> Ladder Tab -> Misc. Options and check the 'Abbreviate Stage Names (Use S0 over $Main.S0)' option.

 

For a complete discussion on Stage Programming and how to use the Stage programming instructions effectively, refer to the Help Topic on Stage Programming Concepts.

 


Parameters:

Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.

 

Index is the memory location where the Index value is located. This can be any readable numeric location.

 

First Stage is the first stage in the range of stages. The First Stage can only be a stage in the same Program; it cannot reference a stage in a different Program. The First Stage reference can be entered using its fully qualified name (for example MyProgram.S0 through MyProgram.S126) or simply its stage number (for example S0 through S126).

 

Last / Exception Stage is the final stage in the contiguous range of stages. The Last Stage can only be a stage in the same Program; it cannot reference a stage in a different Program. The Last / Exception Stage reference can be entered using its fully qualified name - for example MyStage.S0 through MyStage.S127 - or simply its stage number - for example S0 through S127.

 

Automatically create the SG box for any NEW stage number: if a First Stage number, or Last Stage number, or any stages in the contiguous range between them do not exist, those Stages can be automatically created.

 

  • Below this rung means the First stage will be created on a new run following this instruction; as many new rungs as required for the intermediate stages and Last / Exception stage will be added immediately after that.

  • At end of code-block means the First stage will be created as the last rung of the Program; as many new rungs as required for the intermediate stages and Last / Exception stage will be added after that.

 


Status Display:

 

The status display shows the current Index value and which Stages in the contiguous range are enabled .

 


See Also:

JMP - Jump To Stage

 

JMPI - Indexed Jump

 

SG - Stage

 

SGRST - Disable Stage

 

SGRSTI - Indexed Disable Stage

 

SGRSTR - Disable Range of Stages

 

SGSET - Enable Stage

 

SGSETI - Indexed Enable Stage

 

SGDIVRG - Jump to Multiple Stages

 

SGCONVRG - Converge Multiple Stages to SG

 


Related Topics:

Stage Programming Concepts

Introduction

 

Example 1 - A Simple 2-State Process

 

Stage Transition Instructions

 

Example 2 - A Lamp On / Off Controller

 

Example 3 - A Garage Door Opener

 

Review - Steps to Writing Successful Stage Programs

 


Example: