Dynamic call of variable in datablock

mjoha266

Member
Join Date
Jan 2008
Location
Gothenburg
Posts
34
Hello aganin.

I am trying to set a variable in a datablock, and I don't want to use direct adressing...

L #P_nr
OPN DB [#Temp_Int]
T [#CC]

So I want to place the P_nr [Int] variable in (if Temp_Int = 2) DB2.CC so to speak.

Is there any possible solution for this problem? or do I have to use something like:

L #P_nr
OPN DB [#Temp_Int]
T DBW 3 //CC is currently located at byte 3

/Thanks
 
One way would be to use AR1 and load it from your input parameter or calculate it. I don't know where #CC comes from, but for the moment let's assume it has a 3 in it. Your code would look like this:

L #CC
SLD 3
LAR1

L #P_nr
OPN DB [#Temp_Int]
T DBW[AR1,P#0.0]

But you may want to get more familiar with S7 first. It is very odd to want to write to DBW 3, although you may have a reason to do so.
 
Thanks for the qiuck reply!

Although I'm sorry I don't think I made myselfe clear enought.

CC is a variable in DB2 witch is placed at DBW2 (or +2.0) as it says in the "DB view" (Wrote DBW3 before, that was a missprint).
 
Again

Hello again. I'm sorry to take this up again, but I really need an answer to this...

So let's say I have a DB100 ("SysVars") In which I want to change a value at the variable "ProcDoneX" where X is a int from 1 to 10. Let's say that the variables is int's placed in the DB at +2.0 to +20.0

Now I know how to solve this with static mem handling and pointers i.e. to point at place 4.0 for Proc4Done, but is it possible to solve in any other way? How I foremost would like to solve it is just by SysVars."ProcDone" + inVar
(Ok that wouldn't work in any language i ever heard of, but I hope you get the point!)

/Thanks
 
Last edited:

Similar Topics

Hello, I have a requirement to manage the text alignment dynamically. So, for example: 1. English Texts should be displayed from Left in...
Replies
0
Views
90
Rockwell Tech Support seemed to have hit a wall with this question. Already updated the version to 5.00.13 per their suggestio but am still...
Replies
2
Views
217
Maybe this is just not possible, or maybe I am doing something wrong. Background; I have a data array of over 1500 products. For sorting I...
Replies
6
Views
757
HEllo, still satruggling with the curse WinCC Unified. See attached picture. I just want to change the fill colour from turqoise to grey and then...
Replies
5
Views
469
I need assistance with writing a logic for sending data from a Station PLC using 1 MSG instruction to an AGC PLC in every cycle using a CIP Data...
Replies
2
Views
580
Back
Top Bottom