DB indirect addressing with parameters

jormaga

Member
Join Date
Sep 2010
Location
Madrid
Posts
9
Hi everybody!

I'm trying to do quite a simple thing (I think) but I'm stucked and don't know how to implement it...

I call FC6 (DT to DATE) and the RET_VAL parameter I want to use is located at a DBW in a DB with no fixed DB number.

I tried the following code but I got an error, could anybody enlight me and tell how to fix it?


AUF DB [#iDBPlc] // iDBPlc declared as local int
CALL FC 6
IN := #dtDATETIMEPLC // dtDATETIMEPLC declared as local date and time
RET_VAL := DBW30

The date variable was declared at DB2.DBW30 when I ran the code but got an error. When I use RET_VAL := DB2.DBW30 don't get any errors, but it's not flexible the DB number addressing.


Thank you all!

Regards,

Jorge
 
Use a temp variable of type date as the return value from FC6 and then copy the temp variable to DBW30
 
possible solution

I realized that I could do the following:

AUF DB [#iDBPlc] // iDBPlc declared as local int
CALL FC 6
IN := #dtDATETIMEPLC // dtDATETIMEPLC declared as local date and time
RET_VAL := #dDATEPLC // dDATEPLC declared as local date

L #dDATEPLC
T DBW 30

And this really works. I just wondering if there was another way to do it directly without declaring an extra local variable 'dDATEPLC'.
 

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
577
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
649
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,299
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,252
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,902
Back
Top Bottom