Industrial Automation
Industrial Automation | Europe


Main > Product Type > Automation Systems > PLCs
Minimize Text   Default    Enlarge Text


The Address Does Not Update Correctly With IR1 In A Program Using The Index Register As Shown In Figure 1. Why?

Ladder Program Operation Specifications

Before explaining the problems with the ladder program, we will explain the system operation specifications.

*When one of the pushbutton switches from 1 to 32 is pressed, the two words of input data (4-digit BCD data) will be stored in D100 to D131 as shown in the following example.
The Problem with the Ladder Program

So what is the problem with the ladder program?  

To get to the point, there is a problem in the usage of the auto increment option/,IR1+ in --[MOV 2,IR1+] on rung number 10 of the ladder program.

What is the ,IR1[]+ auto increment option?  

IR[]+: The contents of IR[] will be incremented by 1 immediately after accessing the contents of the address that IR[] points to.
The ladder program in Figure 1 works like this. Immediately after the -- [MOV 2 ,IR+1] instruction on rung 10 is executed, the address in IR[] is incremented by 1. In this program, when the --| |--,IR0+ input condition is OFF, the MOV instruction will not be executed. Therefore the auto-increment process will also not be executed. This is the reason why the address update process using IR1 does not function properly.
Note:This problem will not occur with instructions that are executed each scan regardless of the execution condition, such as with --||-- ,IR0+ or with -- (,IR[]+) OUT (which does not appear here).


1.Remove the "+" option from the -- [MOV 2 ,IR1+] instruction to change the instruction to -- [MOV 2 ,IR1] as shown in Figure 2.
2.By using a NO input condition for the Always ON Flag (P_On) together with -- [++L IR1], the address in IR[] will be incremented for every scan of the FOR-NEXT loop.
++L instruction
DOUBLE INCREMENT BINARY instruction. Increments the 8-digit hexadecimal content of two words of data by 1.

*Here, the address (32 bits) stored in IR1 is incremented by 1.

Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2008-11-04
Modified 2016-05-13
Views 3770


You are not logged in.