IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Index Registers, Limitations & out of Range
lostcontrol
post Nov 5 2009, 10:43 PM
Post #1


Sparky
***

Group: MrPLC Member
Posts: 55
Joined: 27-May 09
Member No.: 38,186
Country:New Zealand
New Zealand


Hello Experts, cool.gif

What happens in the Omron world when an Index register tries to address a location that does not exist?

ie. If I have a offset of 10000 from D25000, then the theoretical location is D35000, which as far as I know, does not exist in any of the Omron PLC's.

In the AB world, this sort of thing faults the processor from memory.

I have tried this, and I do not get any errors whatsoever, and of course, proper technique and error checking should be installed to prevent this from ever happening as well!!

Just wandering, that is all.... withstupid.gif



Go to the top of the page
 
+Quote Post
swordfish
post Nov 6 2009, 02:42 AM
Post #2


Sparky
***

Group: MrPLC Member
Posts: 22
Joined: 22-November 06
From: Stockholm
Member No.: 22,415
Country:Sweden
Sweden


If you try to access a non existing address, you will get Illegal Access Error (Symbol Name P_AER in CX-Programmer). The Operation Manual says about P_AER
"Turned ON when an Illegal Access Error occurs. The Illegal Access Error indicates that an instruction attempted to access an area of memory that should not be accessed. When the PLC Setup is set to stop operation for an instruction error (Instruction Error Operation), program execution will be stopped and the Instruction Processing Error Flag (A429510) will be turned ON when the Access Error Flag is turned ON."
Normally the PLC is not set to stop on Instruction Errors, so it could go unnoticed.

In your example, depending on what CPU you are using, its pointing to EM E0_02233 if I calculated correctly.
See attached Memory Map

Attached thumbnail(s)
Attached Image
 
Go to the top of the page
 
+Quote Post
PMCR
post Nov 7 2009, 07:18 AM
Post #3


Sparky
***

Group: MrPLC Member
Posts: 331
Joined: 9-December 04
From: Eastern Pennsylvania
Member No.: 2,808
Country:United States
United States


Lostcontrol


The DM area will flow directly into the EM0 bank, if it exists in the PLC. So, if you are pointing at D32767, and go 1 higher, you end up at E0_0.
There have been several applications where I have used this to make large 1 contiguious memory area out of several EM banks.
Proper bounds checking with IRs is very important, as you noted. This can be done with simple Long Binary comparisons. (>=(325) for example).
The problems that you can cause with improper bounds checking on IRs are numerous. You can overwrite Special IO card setup, CPU bus unit setup (done both of those), as well as possibly the PLC setup (never done that one).
If you use the IR method of addressing inside a for / next loop, and always load the pointer (MOVR) before you enter the loop, you should not have any problems. This is one way that I use IRs frequently.

There are some neat addressing tricks that you can use as well. You cannot do a MOVR D50.07 IR0 (except CJ2), but you can do a MOVL #00100327 IR0.
DM 50 = #0010032.
DM 50.07 = #00100327.
To point to any bit in any channel, you simply tack a '0' - 'F' onto the right hand side of the constant for bit 00 - 15.
You may or may not have found my IR / DR monitor and calculator. This has saved me much work over the years.

http://forums.mrplc.com/index.php?autocom=...mp;showfile=565
Go to the top of the page
 
+Quote Post
Sleepy Wombat
post Nov 8 2009, 08:02 PM
Post #4


Controls Engineer
Group Icon

Group: MrPLC Admin
Posts: 1,717
Joined: 9-October 03
From: Sydney, NSW
Member No.: 760
Country:Australia
Australia


QUOTE
You may or may not have found my IR / DR monitor and calculator. This has saved me much work over the years.

http://forums.mrplc.com/index.php?autocom=...mp;showfile=565


I havn;t seen that either. Thanks mate.


--------------------
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 




RSS Lo-Fi Version Time is now: 20th November 2009 - 06:24 PM