Download as pdf or txt
Download as pdf or txt
You are on page 1of 66

The following example is of Indirect Addressing.

The example will save 12 Timers to an


N File in just six rungs. You can than restore the saved Timer Values from the N Files
back to the Timer in just six rungs.

Rungs 1 to 12 are just the Timers you want to save.


Rungs 13 to 18 will Save all T4 Preset values into N files.
B3:3/0 (on rung 13) is the input that starts the process. O:3/5 will Latch on. Rungs 14
and 15 is an Oscillator OSR Circuit. O:3/0 will oscillate on for one scan and off on the
next. When O:3/0 is on, O:3/1 is off. On Rung 16, O:3/0 will cause C5:0 to count up on
every other scan. On Rung 17, O:3/0 wil cause the Move command to save the T4 preset
values into the N7 files. Rung 18 will unlatch O:3/5 and reset C5:0 when C5:0 is done
Counting (C5:0/DN).

Rungs 19 to 24 will Restore all T4 Preset values from the N files back to the Timers.
Rungs 13 to 18 and 19 to 24 work in the save way. The addressing in the move
command is in reverse.
The Following Truth Table will explain the Indirect Addressing in the Move
Command.

C5:0.ACC T4:[C5:0.ACC].PRE N7:[C5:0].ACC

1 T4:1.PRE N7:1

2 T4:2.PRE N7:2

3 T4:3.PRE N7:3

4 T4:4.PRE N7:4

5 T4:5.PRE N7:5
6 T4:6.PRE N7:6

7 T4:7.PRE N7:7

8 T4:8.PRE N7:8

9 T4:9.PRE N7:9

10 T4:10.PRE N7:10

11 T4:11.PRE N7:11

12 T4:12.PRE N7:12

Lets change the Oscillator OSR Circuit. Delete rung 15 and change rung 14 to look like
this. Rung 14 will now Oscillator itself on and off. We just cut this program down to 5
rungs for the save fuction.
Now combined the Count rung and the Move rung to look like this and to cut one more
rung out of the program.

The Restore Rungs look the same as the save rungs.


Indexed Indirect Addressing

You can use the same idea to restore from or save to a different set of N files by using
Indexed Indirect Addressing. The processor first resolves the indirect portion of the
address and then adds the offset from the Index Register S:24 to come up with the final
address.
This program will not work for T4:0 due to the fact that C5:0 is set to zero then will
count up to 1 before the Move Command saves any values into the N file. If you have
more than 12 Timers to save just set the preset value of C5:0 to the number of timers
you want to save.
Traffic Light with 10 Second Delay Green on South Green
Light
T4:0 - Red for North Light O:3/5 - Red North Light

T4:1 - Green for N/S Lights O:3/4 - Green South Light

T4:2 - Amber for N/S Lights O:3/6 - Green North Light

T4:3 - Green for E/W Lights O:3/7 - Amber N/S Light

T4:4 - 10 second Delay, Green South Light O:3/0 - Green E/W Lights

T4:5, T4:6 - Blink Green North Light O:3/1 - Amber E/W Lights

Use T4:0/TT and T4:4/TT to trun O:3/8 on O:3/3 - Red E/W Lights

branch T4:0/TT and T4:4/TT in one rung O:3/8 - Red South Light (not shown)
Traffic Light with Sequencers

Sequencer Output File #B10:0 to #B10:4 = Length which is 4

00ffh = Mask Value

Position - which step it is on, current step is 1 (B10:1)

Looking at the Offset for Position 1 you can see that N/S Red Light is On and E/W Green
Light is On

Offset 7 Offset 6 Offset 5 Offset 4 Offset 3 Offset 2 Offset 1 Offset 0


Not used Green E/W Amber E/W Red E/W Not Used Green N/S Amber N/S Red N/S
Green Light on for 10 total, Amber Light on for 3 total, Red Light on for 13 total

Word Length or step Lights Time


B10:1 0 N/S Red, E/W Green 10
B10:2 1 N/S Red, E/W Amber 3
B10:3 2 N/S Green, E/W Red 10
B10:4 3 N/S Amber, E/W Red 3
E-Stop/Start/Man/Auto Example

The E-Stop should be hard wired and the PLC should just monitor it to stop the
program (to put machine in Manual Mode). When the E-Stop is pressed all air should
be dumped to any cylinders for safety. Input I:1/1 is a pushbutton. When the E-Stop is
not pressed and the Start button is pressed and Switch (I:1/2) is in Auto Mode then the
machine will Latch in Auto Mode. When the Auto/Man Switch is in Man Mode the
machine will cycle one time when the Start Button is pressed. If switched to Manual
Mode in mid cycle the machine should finish the cycle then stop.
Jump Instruction (JMP)

[Introduction Page] [Command Index] [Programming References]

The JMP instruction is used to cause the PLC to skip over


rungs. The Jump (JMP) instruction is paired with the Label
(LBL) instruction by designating the same address number to
each function. When the jump rung is TRUE, it causes the
ladder program to skip over rungs of the ladder program.

To designate the JMP and LBL commands, parameters may be


entered from Q2: 0 to Q2: 999. One or more JMP instructions
may be used to jump to the same LBL instruction.

The symbol for the jump command is illustrated above. The JMP command is placed on
the right side of the rung. When the rung is activated by a TRUE logical operator or input
control, the JMP instruction skips over the rungs between the JMP instruction and the rung
with the LBL instruction. Execution continues after the rung with LBL. (Note: The JMP
instruction work forward only.) For multiple jumps, a counter can be used to create a do loop
in ladder logic.

If the rung is false the JMP instruction is skipped, causing no jump in the programming
ladder logic. The LBL rung in the ladder logic is treated as any other line in the program and
is scanned each time the program cycles.

The JMP and LBL parameter are assigned to the JMP and LBL commands by positioning the
cursor on the instruction and then double clicking the left mouse button. This opens a text
box so that the parameter value can be entered, or highlight the instruction by selecting it and
typing in the value.

Example Problem 1

Write a ladder logic program that will skip several rungs in a program when I:1/1 becomes
TRUE.
In this example the JMP instruction is activated when I:1/1 is true. This causes the program
to skip to the Q2:0 LBL instruction. The program will continue from the LBL command.

Example Problem 2

Write a ladder logic program that will jump up to T4:2 timer when the output O:2/0 becomes
TRUE.
In this example the JMP command is used to jump to a timer that may be used several times
in the program.

OSR
The following is an example of how the OSR command works with a 2 rung Ladder Logix.
This 2 rung program is an One-Shot.

The One-Shot Output B3:3/2 will be triggered for the duration of one program scan
and then goes off. The one-shot can be triggered from a momentary signal, or one that
comes on and stays on for some time. The above 2 rung program is how the [OSR]
command works.

OSR-1
The following is an example of the OSR command and its Logix.

Example OSR-1
Input Scan=I:1/0 is On

Input Scan - 0:3/0 On, 0:3/1 On, 0:3/2 On

Next Scan - 0:3/0 Off, 0:3/1 On, 0:3/2 On

Reset Scan - 0:3/1 Off, 0:3/2 Off

OSR-2
In the next Example rungs 1 and 2 are reversed from the above example.

Example OSR-2
Input Scan = I:1/0 is On

Input Scan - 0:3/1 On, 0:3/2 On


Next Scan - 0:3/1 Off, 0:3/2 On

Input Scan - 0:3/1 On, 0:3/2 On, 0:3/1 On


Next Scan - 0:3/1 Off, 0:3/2 On, 0:3/1 On

Reset Scan - 0:3/2 Off, 0:3/1 Off

Flip/Flop Circuit using an OSR


"Can Use As Auto/Manual Button"

I:1/0 is a pushbutton switch or an Input from an Panel View (Touch Screen). You can
use this Logix as a Auto/Man button, using one input to put a machine in Automatic or
Manual with just one Pushbutton. Output B3:3/3 will Flip/Flop on with one push of the
button then off with the next push of the button.

Put an contact in the above example to monitor an E-Stop to put the machine in
Manual on shutdown/stopping the machine. Input I:1/1 will trun off Output B3:3/3 and
put the machine in Manual.
Label Instruction (LBL)
[Introduction Page] [Command Index] [Programming References]

The (LBL) instruction is used by the jump (JMP) instruction


as a target for the jump. In order to designate the (JMP) and
(LBL) commands, parameters may be entered from Q:0 to
Q:999. One or more (JMP) instructions may be used to jump to
the same (LBL).

The Label (LBL) instruction is paired with the Jump (JMP)


instruction by designating the same number in each function.
When the JMP command is TRUE, it allows the program to
skip over portions of the ladder program an restart execution in
the rung designated by LBL instruction.

The symbol for the LBL instruction is illustrated above. The LBL instruction is placed
on the left side of the rung. The LBL command indentifies the jump (JMP) target for the
command. The LBL instruction is not located under the JMP command in the programming
logic, then a FAULT will occur. The label command becomes TRUE when activated by a
jump command and any other logic inbedded on the rung is evaluated.

The JMP and LBL parameter are assigned to the JMP and LBL commands by positioning the
cursor on the instruction and then double clicking the left mouse button. This opens a text
box so that the parameter value can be entered, or highlight the instruction by selecting it and
then typing in the value.

NOTE: Rungs with the LBL commands will be scanned by the processor even if the JMP
instruction was not executed. Do not place the LBL inside a Master control reset (MCR)
zone. Any instructions located between the LBL instruction and the End MCR instruction
will always be evaluate as if the MCR instruction were TRUE without regard to its actual
state.

Example Problem 1

Write a ladder logic program that will skip several rungs in a program when I:1/1 becomes
TRUE.

In this example the JMP instruction is activated when I:1/1 is true. This causes the program
to skip to the address Q2:0 LBL instruction. The program will continue from the LBL
command.

Example Problem 2

Write a ladder logic program that will jump up to T4:2 timer when the output O:2/0 becomes
TRUE.
In this example the JMP command is used to jump to a timer that may be used several times
in the program.
FIFO Load / FIFO Unload

The following is an example of the FIFO Load and FIFO Unload command.

All Inputs are Pushbuttons so you need to use the OSR Command. Without the OSR
command N7:12 would be filled up with one push of the Push Button. When inputs
I:1/0, I:1/1, I:1/2 are true FIFO Load will load the corresponding number into N7:12.
When I:2/1 is true FIFO Unload will unload the first number loaded into N7:11.
After it is unloaded from N7:12 into N7:11, then the Equal commands will compare
what is in N7:11 to 12, 13, and 14. When Source A (N7:11) equals Source B (12,13 or
14) then the corresponding Output (O:3/1, O:3/2 or O:3/3) will be true. When Input
I:1/3 is true, the Move command will move Source 0 into N7:11, Resetting N7:11. Then
I:2/1 can then unload the value from N7:12 into N7:11 again.
By adding Rung 8 to the above program you can add a Memory Clear Push Button.
The FIFO Unload will unload all of the values in N7:12 into N7:10, clearing N7:12 and
the Move command will clear N7:11 by moving Source A (0 - zero) into N7:11.
Jump to Subroutine Instruction (JSR)
[Introduction Page] [Command Index] [Programming References]

The jump to subroutine (JSR), subroutine (SBR), and return (RET) instructions are used to
direct the controller to execute a separate subroutine file within the ladder program and
return to the instruction following the JSR instruction.

The jump to subroutine(JSR) instruction, when executed,


jumps to the beginning of the designated subroutine file and
resumes execution at that point.

The symbol for the Jump to Subroutine command is illustrated above. The JSR command
is placed on the right side of the rung. When the rung is TRUE, the JSR instruction
jumps to a designated subroutine file stored in the program files folder.

To enter a parameter into the JSR command, highlight the command and type a number between (3
- 255).
Use the following prodedure to create a subroutine folder:

1. In the left split screen, left mouse click the program files folder to highlight.
2. Right mouse click on the file folder to open menu box.
3. Select new.
4. Type the same number that was entered into the JMP command.
5. Optional, name the subroutine folder in space provided.

Use the tab on the bottom of the ladder logic program to switch between the main logic program
and the SUBROUTINE program.

The subroutine folder should have a subroutine(SBR) instruction and a return from
subroutine (RET) instruction. The SBR instruction must be the first instruction on the first
rung in the program files that contain the subroutine. The RET marks the end of the
subroutine execution or the end of the subroutine file. It causes the controller to return to the
program where the JSR command instruction was placed and resumes' execution of that
program.

After the JSR is activated the scanning order for the PLC ladder includes: The PLC jumps to
the labeled subroutine, scans the subroutine program, and returns to the main program to
continue to scan the main program rungs after the JSR command. If a timer is located within
the SBR, the JSR must have a latched input in order for the timer to reach the preset time.
Once the timer has completed the timer cycle, it unlatches the contacts holding the JSR
command in the TRUE state by using a rung in the subroutine file.

If the JSR instruction is FALSE, the subroutine is skipped.

Example Problem

Use a subroutine command to count the number of parts passing through a system. When the
counter reaches ten, have the controller turn off an output.
In this example the subroutine contains a counter. Each time the JSR inputs are activated in
the main program by either the I:1/0 or I:1/5 the counter counts up by one in the subroutine
program. This example allows parts to be countered at two different places. When the
counter reaches ten O:2/9 is disabled.
Jump/Label Example

I:1/0 will Lacth B3:3/0 on. If B3:3/0 is on then, the Jump command will jump over
rungs 3 and 4 to rung 5 with the Label command. As long as B3:3/0 is latched on rungs
3 and 4 will never be scaned. I:1/1 will Unlacth B3:3/0 and let rungs 3 and 4 to be
scaned.

JSR/SBR/RET Example
Lad 2

In the JSR command the U:3 refers to Lad 3 (The Subroutine Ladder)
Lad 3

The RET command will return the scan to Lad 2 Rung 3 after the Subroutine Ladder is
done.
Program Condition Example

Valves will be open based on the Conditions set in the Program Logix.

Valve A Open If A is Closed B is Closed A is not Jamed


(O:3/0) (O:3/7) (O:3/6) (T4:0)
Valve B Open If B is Closed C is Closed A is Open B is not Jamed
(O:3/1) (O:3/6) (O:3/5) (O:3/3) (T4:1)
Valve C Open (O:3/2) If C is Closed (O:3/5) B is Open (O:3/4) C is not Jamed (T4:2)
Return From Subroutine Instruction (RET)
[Introduction Page] [Command Index] [Programming References]

The RET command is used in conjunction with the jump to subroutine (JSR), and
subroutine (SBR) commands. The instructions are used to direct the controller to execute a
separate subroutine file within the ladder logic program and return to the previous program at
the rung following the JSR instruction.

The return from subroutine (RET) instructions marks the end of


the subroutine execution or the end of the subroutine file. It causes
the controller to return to the program where the JSR command
instruction was placed and resume execution of that program,
following the JSR instruction.

The symbol for the Return to Subroutine command is illustrated above. The RET command
or commands can be placed within or at the end of the subroutine file. The RET
instruction may be conditional if the rung conditional logic is true. This way the controller
omits the balance of a subroutine only if the rung conditional logic is true.
Use the tab on the bottom of the ladder logic program to flip between the main logic program
to any subroutine programs.

In the following figure 1-1, is a basic subroutine ladder logic program.

Figure 1-1 subroutine program.


In the following figure 1-2, is a basic subroutine ladder logic program with multiply returns.
This allows the program to return from a subroutine quicker, if certain conditions are met
skipping the remainder of the subroutine.

Figure 1-2 multi-return subroutine program.

After the JSR is activated the scanning order for the PLC ladder includes: The PLC jumps to
the labeled subroutine, scans the subroutine program, and returns to the program where the
JSR was placed in order to continue to scan that program. The scanning continues from the
rung after the JSR command. If a timer is located within the SBR, the JSR must have a
latched input in order for the timer to reach the preset time. Once the timer has completed the
timer cycle, within this file unlatch the contacts switch within the subroutine.

If the JSR instruction rung is false, the subroutine is skipped.

Example Problem

Use a subroutine command to count the number of parts passing through a system. When the
counter reaches ten, have the controller turn off an output.
In this example the subroutine contains a counter. Each time the JSR inputs are activated in
the main program by either the I:1/0 or I:1/5 the counter counts up by one in the subroutine
program. This example allows parts to be countered at two different places. When the
counter reaches ten O:2/9 is disabled.
Bit Shift Left (BSL) Example for a Production Line

I:1/0 shifts the bit to the left as the line moves. I:1/1 detects an item on the line and puts
a bit (1) in file #B3:0. As the bit shifts Spray 1 will spray and then Spray 2 will spray.
Counter C5:1 counts as the item enters and C5:2 counts as the item exits.
Data file B3 showns a bit in B3:0/1 (Spray 1) and B3:0/4 (Spray 2).
Subroutine Instruction (SBR)
[Introduction Page] [Command Index] [Programming References]

The subroutine (SBR) instruction, is the destination or target for


the JSR instruction. The SBR instruction must be the first
instruction on the first rung in the program files that contain the
subroutine.

The symbol for the subroutine command is illustrated above. The SBR command is
placed on the first rung of the subroutine file. A subroutine is used to store recurring sections
of program logic that must be executed from several points within the main program logic.
When the rung is TRUE, the JSR instruction jumps to a designated subroutine file stored in
the program files folder.

To enter a parameter into the JSR command, highlight the command and type a number between (3
- 255).
Use the following prodedure to create a subroutine folder:

1. In the left split screen, left mouse click the program files folder to highlight.
2. Right mouse click on the file folder to open menu box.
3. Select new.
4. Type the same number that was entered into the JMP command.
5. Optional, name the subroutine folder in space provided.

Use the tab on the bottom of the ladder logic program to switch between the main logic program
and the SUBROUTINE program.

The subroutine folder should have a subroutine(SBR) instruction and a return from
subroutine (RET) instruction. The SBR instruction must be the first instruction on the first
rung in the program files that contain the subroutine. The RET marks the end of the
subroutine execution or the end of the subroutine file. It causes the controller to return to the
program where the JSR command instruction was placed and resumes' execution of that
program.
Use the tab on the bottom of the ladder logic program to flip between the main logic program
to the subroutine program.

After the JSR is activated the scanning order for the PLC ladder includes: The PLC jumps to
the labeled subroutine, scans the subroutine program, and returns to the main program to
continue to scan the main program rungs after the JSR command. If a timer is located within
the SBR, the JSR must have a latched input in order for the timer to reach the preset time.
Once the timer has completed the timer cycle, it unlatches the contacts holding the JSR
command in the TRUE state by using a rung in the subroutine file.

If the JSR instruction is FALSE, the subroutine is skipped.

Example Problem

Use a subroutine command to count the number of parts passing through a system. When the
counter reaches ten, have the controller turn off an output.
In this example the subroutine contains a counter. Each time the JSR inputs are activated in
the main program by either the I:1/0 or I:1/5 the counter counts up by one in the subroutine
program. This example allows parts to be countered at two different places. When the
counter reaches ten O:2/9 is disabled.
Program Condition Example

Valves will be open based on the Conditions set in the Program Logix.

Valve A Open If A is Closed B is Closed A is not Jamed


(O:3/0) (O:3/7) (O:3/6) (T4:0)
Valve B Open If B is Closed C is Closed A is Open B is not Jamed
(O:3/1) (O:3/6) (O:3/5) (O:3/3) (T4:1)
Valve C Open (O:3/2) If C is Closed (O:3/5) B is Open (O:3/4) C is not Jamed (T4:2)
Status Bit Examples
S2:40 is the hour clock bit, S2:41 is the minute clock bit and S2:42 is the second clock
bit. The clock bits can be used to trigger a function at a given time. As in the example
above the Counter will be reset when the time is 11:30 and 15 seconds.

S2:4/7 is one of the Clock Cycle bits. You can same scan time by using this bit. In the
example above the N10:0 will be copied into N11:0 every 2.56 seconds.
S2:1/15 is the First Pass Bit. The rung is true only for the first scan after entering the
run mode. Upon the first scan Timer T4:0 and T4:1 will be set to default times in N12:0
and N13:0.
Temporary End Instruction (TND)
[Introduction Page] [Command Index] [Programming References]

The Temporary End (TND) instruction is used to progressively


debug a program, or conditionally omit the balance of your current
program file or subroutine.

The symbol for the temporary end command is illustrated above. The TND command is
placed on the right side of the rung. When the rung is activated, the TND instruction stops
the processor from scanning the rest of the program file. The TND instruction then updates
the I/O, and restarts scanninig at the beginning of the program. If the TND instruction is
false, the processor continues scanning until the next TND instruction or the END statement
is read.

NOTE: When using the TND instruction within a nested subroutine, the TND command will
terminate all of the nested subroutine.

Example Problem

Create a program with two TND instructions to debug portions of the program.
In the example, placing the TND's in the program allows the programmer to test a section of
the progam for any errors. By using external switches, a portion of the program ladder logic
is scanned at a time. The example shows the program ladder logic was split into three
sections using the TND command. When switch I:1/0 is active the program scans down to
that rung (0005) then jumps back to the beginning of the program and continues the scan. If
I:1/0 is de-activated and I:1/4 (rung 0009) is activated the program will scan down to this
rung and return to the beginning of the program. De-activating both TND's will allow the
program to continue to scan the third section of the program.
Master Control Reset Instruction (MCR)
[Introduction Page] [Command Index] [Programming References]

The Master Control Reset (MCR) instruction is used in pairs to


create zones that clear all set outputs within that zone; i.e., it turns
off all the non-retentive outputs in the zone. Non-Retentive outputs
do not retain their memory when de-energized and are reset. The
rungs contained within the two MCR commands called a zone are
still scanned, but the scan time is reduced due to the false state of
non-retentive outputs.

The symbol for the Master Control Reset command is illustrated above. The MCR command
is placed on the right side of the rung. This output instruction is used to set up areas or
"zones" of your ladder program where all non-retentive outputs may be disabled at the same
time for the same length of time. MRC's are used in pairs, one MCR is used to define the
start of the ladder area to be affected and one MCR to define the end of the area.
An input instruction is programmed on the rung of the first MCR to control rung logic
continuity. When the rung goes "false" all set outputs within that zone are scanned as false
i.e. all non-retentive outputs within the controlled zone are disabled. When the rung goes
"true" all rungs are scanned according to their normal rung conditions.

The Master Control Reset ID numbers, -32,768 to +32,767, are assigned to the MCR command by
positioning the cursor to the right of the Master Control Reset ID in the command and then double
clicking the left mouse button. This opens a text box so that the constant value for the source may
be typed.

The ending MCR instruction must be the only instruction on the rung.

WARNING!
 Do not use conditional logic before an ending MCR instruction.
 The MCR instruction is not a substitute for a hard-wired master control relay that provides
emergency stop capability.
 MCR controlled areas must contain only two MCR instruction- one to define the start and
one to define the end.
 When editing a rung that contains an MCR instruction, both the MCR start and MCR end
rungs must be edited at the same time.
 If you start instructions such as timers or counters in an MCR zone, instruction operation
ceases when the zone is disabled. The TOF timer will activate when placed inside of a false
MCR zone.

Example Problem

Use the MCR command to isolate a section of a program.

In this example, when I:1/1 is TRUE the Master Control Reset command allows normal scan
with normal effects on the outputs. A false input to the first MCR command, disables any
outputs within the zone (O:2/1).
Suspend Instruction (SUS)
[Introduction Page] [Command Index] [Programming References]

The suspend (SUS) instruction is used when you want to debug


or diagnose your user program. When SUS is true, this
instruction places the controller in the Suspend Idle mode. The
suspended idle mode halts the program when activated.

The symbol for the Suspend command is illustrated above. The SUS command is placed
on the right side of the rung. When the SUS rung is TRUE, the instruction places the PLC in
suspend idle mode and de-energizes all outputs.
The suspend ID numbers, -32,768 to +32,767, are assigned to the SUS command by
positioning the cursor to the right of the Suspend ID in the command and then double
clicking the left mouse button. This opens a text box so that the constant value for a source
may be typed.

Example Problem

Use the SUS command to suspend a program.


In this example when I:1/0 is False or I:1/1 is TRUE the suspend command stops the
program scan, de-energizes the outputs and activates the status bit. To return to run mode, on
the upper left screen pull down menu, click on the "Yellow Colored SUSPEND" and select
run. By using multiple SUS commands allows the ladder programmer the ability to section
the ladder into section that may be stop at anytime. This command allows the ladder
programmer to easily debug a program by progressively stop the ladder section to finds an
incorrect result.
Immediate Input with Mask Instruction
(IIM)
[Introduction Page] [Command Index] [Programming References]

The Immediate Input with Mask (IIM) instruction allows the


ladder programmer to update data prior to the normal input scan.

The symbol for the Immediate Input with Mask command is illustrated above. The IIM
command is placed on the right side of the rung. When the IIM rung is TRUE, the
program scan is interrupted, and data from a specified input slot is transferred through the
mask to an input data file. This data is available to the commands in the ladder, following the
IIM instruction.
The IIM operates on the inputs assigned to a particular word of a slot (16 bits maximum).
For the mask, a (1) in the bit position passes data from the source to the destination. A (0)
inhibits data bits from passing from the source to the destination.

Values and addresses are assigned to the IIM command by positioning the cursor to the right
of the slot, mask, and length location in the command and then double clicking the left
mouse button. This opens a text box so that the input or the constant values for the IIM
command may be typed. You can enter the constant in binary, decimal, or hexadecimal.

Slot: Specifies the input slot on the PLC and specific input word. Example I:1.0 means input of slot 1
word 0.

Mask: Specify a Hex constant or register address. OFFFh is a mask value that will allow all of the (1)
bits to pass through.

Length: This parameter is used to transfer more than one word per slot, only for the SLC 5/03 and
5/04 processors. For example, fixed and SLC 5/01 controllers can have up to 8 words associated with
the slot. The SLC 5/02, 5/30, 5/04, and 5/05 controllers can have up to 32 words associated with the
slot.
Example Problem

Write a ladder logic program that will update a specific input in the middle of a program.
The value for the mask will be 000Fh.

In this example the IIM instruction retrieves data from I:1.0 and passes it through the mask.
The mask permits only the four least significant bits to be moved to the input register I:1.0,
allowing the ladder programmer to only update sections of the inputs to be used throughout
the rest of the program.

Immediate Output with Mask Instruction


(IOM)
[Introduction Page] [Command Index] [Programming References]
The Immediate Output with Mask (IOM) instruction allows the
ladder programmer to update data prior to the normal Output
scan.

The symbol for the Immediate Output with Mask command is illustrated above. The IOM
command is placed on the right side of the rung. When the IOM rung is TRUE, the
program scan is interrupted, and data from a specified output slot is transferred through the
mask to an output data file. This data is available to the commandsin the ladder, following
the IOM instruction.

The IOM operates on the outputs assigned to a particular word of a slot(16 bits maximum).
For the mask, a (1) in the bit position passes data from the source to the destination. A (0)
inhibits data bits from passing from the source to the destination.

Values and addresses are assigned to the IOM command by positioning the cursor to the
right of the slot, mask, and length location in the command and then double clicking the left
mouse button. This opens a text box so that the output or the constant values for the IOM
command may be typed. You can enter the constant in binary, decimal, or hexadecimal.

Slot: Specifies the output slots on the PLC and specific output word. Example O:1.0 means output of
slot 1 word 0.

Mask: Specify a Hex constant or register address. OFFFh is a mask value that will allow all of the (1)
bits to pass through.

Length: This parameter is used to transfer more than one word per slot, only for the SLC 5/03 and
5/04 processors. For example, fixed and SLC 5/01 controllers can have up to 8 words associated with
the slot. The SLC 5/02, 5/30, 5/04, and 5/05 controllers can have up to 32 words associated with the
slot.

Example Problem

Write a ladder logic program that will update a specific output in the middle of a program.
In this example the IOM instruction retrieves data from O:2.0 and passes it through the mask.
The mask permits only the four least significant bits to be moved to the ouput register O:2.0,
allowing the ladder programmer to only update sections of the output throughout the rest of
the program.

I/O Refresh Instruction (REF)


[Introduction Page] [Command Index] [Programming References]

The Refresh (REF) instruction is used to update all the input and
output bits in the controller in the middle of a program.
The symbol for the refresh command is illustrated above. The REF command is placed
on the right side of the rung. The REF instructions stops scanning program , executes the I/O
scan to update the inputs and outputs when the logic controlling the REF command becomes
true. Then the scan resumes at the instruction following the REF command.
The Channel 0 and 1 is changed from NO to YES, by positioning the cursor to the right of
the Channel in the command and then double clicking the left mouse button. This opens a
text box so that you can select YES or NO. These communication ports are found on the
front of the CPU card of the PLC and may be configured for a specific purpose.

 DF1 is channel 0
 DH485 is channel 1

The REF instruction has no programming parameters when used with the 5/02 processor. With the
5/30, 5/04 and 5/05 processors, however, you can select a specific communication channel or both
channels for servicing.
NOTE: The REF command should only be placed in a program that has been thoroughly analyzed.
When the REF instruction is executing, watchdog and scan timers are reset. Do not place the REF
inside a non-terminating programming loop.

Example Problem

Use the refresh command to update the I/O in the middle of the program.
In this example the REF command updates the DF1 channel, when the input switch is
activated.

You might also like