Download presentation
Presentation is loading. Please wait.
Published byLinda Willis Modified over 8 years ago
1
Do-more Technical Training Instruction Set (Program Control)
2
Instruction Set THE BASICS ▫1▫181 instructions CContact (14) CCoil/Bit Output (11) AAnalog/Process (13) DDate/Time/Calendar (7) EEthernet (5) HHardware/Device (9) HHigh Speed/CTRIO (19) MMath (5) MMisc/Data Manipulation (23) PProgram Control (20) PProgram-Looping (8) PProtocol-Custom/ASCII (7) PProtocol-Standard (10) SString (14) TTimer/Counter/Drum (16)
3
THE BASICS ▫1▫181 instructions IIn-line (100) – n nn no flag EExecutes completely in-line on same scan FFully Asynchronous (48) – R RR Red DDependent on shared Device’s availability LLocks Device when executed to make it exclusive UUnlocks Device after it is finished MMust not terminate before it is finished MMust wait for Success or Error indication MMulti-scan (20) – Y YY Yellow TTakes 2 or more scans to complete or function properly DDepend on the status of the instruction from previous scan ((Edge-triggering inputs normally take 2 also) YYielding (5) – B BB Blue CCan temporarily postpone operation until next scan (YIELD) SSkipping (6) – G GG Green CCan skip forward or backward in code (EXIT, REBOOT, RESTART, STOP, WATCHDOG) YYielding/Skipping (2) - B BB Blue Green CCan temporarily postpone operation until next scan and skip forward or backward in code (GOTO) Box Instruction Corner
4
Instruction Set (Program Control) Program Control ▫E▫ENTASK ▫E▫E▫E▫EXIT ▫G▫G▫G▫GOTO ▫H▫HALT ▫J▫JMP (Stage) ▫J▫JMPI (Stage) ▫L▫LABEL ▫R▫R▫R▫REBOOT ▫R▫R▫R▫RESTART ▫R▫RUN ▫S▫SG (Stage) ▫S▫SGCONVRG (Stage) ▫S▫SGDIVRG (Stage) ▫S▫SGRST (Stage) ▫S▫SGRSTR (Stage) ▫S▫SGSET (Stage) ▫S▫S▫S▫STOP ▫S▫SUSPEND ▫W▫W▫W▫WATCHDOG ▫Y▫Y▫Y▫YIELD
5
GOTO “Go To Label” ▫I▫Immediate branch to LABEL instruction CCannot reference Labels in a different Program/Task IIf inside FOR/NEXT, WHILE/WEND, or REPEAT/UNTIL loop, cannot target Labels outside that loop CCannot target Labels in a different stage BBranching backward subjects it to yielding (blue triangle) LABEL “Program Label” ▫T▫The target of the G GG GOTO instruction
6
REBOOT “Reboot PLC” ▫C▫Causes CPU to perform a cold reboot (just like a power cycle)
7
RESTART “Restart Program or Task” ▫S▫Stops Program or Task then restarts it so that it begins running from the beginning RResets Stages, clears internal flags, counters, etc.
8
STOP “Switch to Program Mode” ▫C▫Causes CPU to go to STOP (Program) Mode SSince there is no way, of course, to programmatically switch back to RUN Mode, this could be a safety concern
9
SUSPEND “Suspend Program or Task” ▫S▫Suspends the target Program or Task from running TThe current state of all ladder logic in target is maintained ..InstrSuspend = ON NName of target is shown in y yy yellow CCannot suspend itself
10
WATCHDOG “Force Watchdog Error” ▫G▫Generates a software or hardware watchdog error UUsed to verify emergency shutdown PParameters: FFire Software Watchdog ▫C▫CPU goes to STOP (Program) Mode ▫A▫Acts like scantime > $WatchdogTimeVal (DST23) FFire Hardware Watchdog ▫D▫Depends on setup of $DisableHwWdog (ST25) & $HwWatchdogMode (ST24) IIf input logic is retentive & Mode switch is in RUN or TERM, CPU will execute Force Watchdog Error instruction continuously. PPlace Mode switch in STOP to break out of this
11
YIELD “Yield Program or Task” ▫S▫Stops execution of current Program or Task & passes control to next code block in the execution order YYields (blue triangle) regardless of value in.TimeSlice CCode block continues at instruction directly below upon next execution UUsed so scantime can be controlled EE.g. Program normally takes long time to complete ▫I▫Inserting YIELDs in the code breaks it up 1 st scan 2 nd scan
12
Stage Programming Introduction to sequencing ▫Ladder logic Pros Pros: Very good at controlling concurrent processes Cons Cons: Not good at controlling sequential processes Not good at event-driven sequences Programs get filled with numerous interlocking bits Difficult to debug Difficult to modify All logic impacts scantime
13
Stage Programming Ladder Program ▫S▫States of Y0 OOFF OON ▫I▫Initially Y0 = OFF ▫X▫X0 causes Y0 to transition to ON state ▫X▫X1 causes Y0 to transition to OFF state
14
State Diagram ▫S▫States of Y0 OOFF OON ▫I▫Initially Y0 = OFF ▫X▫X0 causes Y0 to transition to ON state ▫X▫X1 causes Y0 to transition to OFF state OFF ON Y0 X0 X1 OFF ON
15
Stage Programming Sequence Diagram ▫S▫States of Y0 OOFF OON ▫I▫Initially Y0 = OFF ▫X▫X0 causes Y0 to transition to ON state ▫X▫X1 causes Y0 to transition to OFF state
16
Stage Program ▫S▫States of Y0 OOFF OON ▫I▫Initially Y0 = OFF ▫X▫X0 causes Y0 to transition to ON state ▫X▫X1 causes Y0 to transition to OFF state
17
Numbering ▫T▫Tasks do not have Stages ▫P▫Programs can have 128 Stages (SG; S0-S127) each ▫S▫Stage number does not determine sequence The Initial Stage is the first one (very top) Enabling/Disabling ▫E▫Enabled Stages are executed each PLC scan ▫W▫When a Stage is enabled/scanned the first time it artificially generates an “edge” by setting Edge bits for each bit in the Stage that is already ON when the Stage was enabled* ▫D▫Disabled Stages are not scanned ▫A▫A disabled Stage runs a “Termination Scan” immediately following the scan in which it was disabled *Exception: Bits associated with Counter instructions
19
Enabling: target ▫When the Stage is the target of: (1) JMP “Jump To Stage” (2) JMPI “Indexed Jump” (3) SGSET “Enable Stage” (4) SGDIVRG “Jump to Multiple Stages” (5) SGCONVRG “Converge Multiple Stages to SG” Disabling: ▫When the Stage is: source The source of: (1) JMP “Jump To Stage” (2) JMPI “Indexed Jump” (4) SGDIVRG “Jump to Multiple Stages” (5) SGCONVRG “Converge Multiple Stages to SG” target The target of: (6) SGRST “Disable Stage” (7) SGRSTR “Disable Range of Stages”
20
Stage Programming JMP “Jump To Stage” ▫D▫Disables Stage in which it is contained & enables the “jump-to” Stage ▫P▫Parameters: TTransition To – target Stage to “jump” to ▫N▫NOTES: DDoes not “jump” immediately CCode between the JMP and end of the Stage is still scanned / executed CCannot “jump” to Stages in other Programs
21
JMPI “Indexed Jump” ▫D▫Disables Stage in which it is contained & enables the “jump-to” Stage based on an Index ▫P▫Parameters: IIndex – memory location of index value FFirst Stage – 1 st Stage in range for index = 0 LLast/Exception Stage – Stage to “jump” to if index is out of range ▫N▫NOTES: DDoes not “jump” immediately CCode between the JMPI and end of the Stage is still scanned / executed CCannot “jump” to Stages in other Programs
22
SGSET “Enable Stage” ▫Enables target Stage ▫Parameters: Stage – target Stage to enable ▫NOTES: Does not disable Stage containing SGSET Cannot enable Stages in other Programs
23
Stage Programming SGRST “Disable Stage” ▫D▫Disables target Stage ▫P▫Parameters: SStage – target Stage to disable ▫N▫NOTES: IIf it disables itself, code between the SGRST & end of the Stage is still scanned / executed CCannot disable Stages in other Programs
24
SGRSTR “Disable Range of Stages” ▫D▫Disables a range of Stages ▫P▫Parameters: SStart Stage – 1 st Stage in range to disable EEnd Stage – last Stage in range to disable ▫N▫NOTES: IIf it disables itself, code between the SGRSTR & end of the Stage is still scanned / executed CCannot disable Stages in other Programs
25
SGDIVRG “Jump to Multiple Stages” ▫D▫Disables Stage in which it is contained & enables all Stages listed ▫P▫Parameters: TTransition To – list of Stages to enable ▫N▫NOTES: CCannot disable Stages in other Programs
26
SGCONVRG “Converge Multiple Stages to SG” ▫D▫Disables listed Stages & enables target Stage based on condition ▫P▫Parameters: SStage – target Stage to be enabled FFrom Stages – list of Stages to be disabled when condition is true TThen converge when – condition causing the convergence ▫N▫NOTES: CCannot use Stages in other Programs
27
Design Stage Program ▫X0 is for door control ▫X1 indicates door is raised ▫X2 indicates door is lowered ▫Y1 must be energized to raise the door ▫Y2 must be energized to lower the door
28
Stage Programming Design Stage Program Initially, the door is down When X0 comes ON, Stage0 is disabled and Stage1 is enabled When X0 goes OFF, Stage1 is disabled and Stage2 is enabled Y0 turns the motor ON to raise the door When X1 comes ON (indicating the door has reached its upper limit), Stage2 is disabled and Stage3 is enabled The door is in the up position When X0 comes ON, Stage3 is disabled and Stage4 is enabled When X0 goes OFF, Stage4 is disabled and Stage5 is enabled Y1 turns the motor ON to lower the door When X2 comes ON (indicating the door has reached its lower limit), Stage5 is disabled and Stage0 is enabled When Stage2 is disabled, Y0 automatically goes OFF When Stage5 is disabled, Y1 automatically goes OFF The door is back to the initial position (down)
29
Stage Programming Design Stage Program ▫A▫Add Y3 as the safety light ▫Y▫Y3 must come ON each time door is activated (up or down) ▫Y▫Y3 must go OFF after a timeout
30
Design Stage Program When the door has been triggered to go up, Stage6 (a new stage) is enabled When the door has been triggered to go down, Stage6 (a new stage) is enabled New Stage6 is added Y3 comes ON and Timer0 is started… When Timer0 is done (3 minutes), Stage6 disables itself When Stage6 is disabled, Y3 automatically goes OFF and Timer0 is reset
31
Stage Programming Design Stage Program ▫Add X3 as emergency stop ▫X3 must cause door to raise
32
Stage Programming Design Stage Program When the door has been triggered to lower and there’s an obstruction, Stage5 is disabled and Stage2 is enabled to shut OFF the lowering motor (Y1) and turn ON the raising motor (Y0)
33
Instruction SetInstruction Set (Program Control)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.