indirect addressing

Join Date
Jun 2013
Location
Sandviken
Posts
5
Hi, I'm trying to access a DB whith indirect adressing.
When I have them in this order "Status_HMI".receptnummer gets the value stored in the DB that AR1 + 28.0 points to but not "Status_HMI".datalogsnummer

L DBW [AR1,P#28.0]
T "Status_HMI".receptnummer

L DBW [AR1,P#26.0]
T "Status_HMI".datalogsnummer


When I switch order like down below "Status_HMI".datalogsnummer gets the value stored in AR1 + 26.0 but not "Status_HMI".receptnummer

L DBW [AR1,P#26.0]
T "Status_HMI".datalogsnummer

L DBW [AR1,P#28.0]
T "Status_HMI".receptnummer

I have no clue to why this happens. Can anybody help me?
 
You can only have one global DB open at a time.

As you haven't posted all the relevant code, I'll guess you have an OPN DBx before the code you have posted.

Code:
T "Status_HMI".receptnummer

exeutes as follows (I've made up the address as you have posted the symbolic address)

Code:
opn "Status_HMI"
T DBW300
 
Hi and thanks,I tested it but it still doesn't work. The problem is the same. The first is executed but not the other one. Something happens when the pointer is supposed to load the second one and only gets a "0" even thow there is a value there. But if I switch the order of them the PLC can read it. I can read the adress if I direct adress it. And then I can move it to my DB "status_hmi". So I have access to both DB:s but not two times in a row.

Regards
 
Hi again. I didn't get properly what you meant. Now I use your code opn "status_hmi" before and between I use opn DB and now it works. So now it works as it should. Thanks very much. Regards Anette
 
To make this work you need to open the DB you are accessing via AR1 before each and every access as follows:

Code:
OPN "DBSomething"
L DBW [AR1,P#28.0]
T "Status_HMI".receptnummer


OPN "DBSomething"
L DBW [AR1,P#26.0]
T "Status_HMI".datalogsnummer
 

Similar Topics

Howdy folks, I am an Allen Bradley guy currently living in an Emerson world. Working with Rx3i on PacSystems Machine Edition v. 9.6? i think...
Replies
3
Views
613
Hello, I'm very new to programming with absolutely zero schooling in this field and pretty hands off training in my new role, it's been fun...
Replies
4
Views
664
Hello Friends, I am trying to index M Bits, however GX Works2 is not allowing it with following message. https://ibb.co/zPcqj6M...
Replies
3
Views
1,373
Hi All, which the best way to do the indirect addressing in an optimize DB? Ccurrently this is my partial code inside an FB...
Replies
7
Views
2,268
Hey everyone, Just used the PLC5/Logix migration utility to convert a program, and while addressing the PCEs, I noticed a lot of errors for "XIC...
Replies
12
Views
1,954
Back
Top Bottom