S7 dynamic addressing issue

The value in DB8001.DBW52 is an integer equal to the number that the operator has entered in the first network, say part 3...

Byte 52 of every part in the 1-100 array will be what that part is (this should be reflected in DB8001). So the byte in DB8001.DBW652 should be the value of '3', along with all the other data that belongs to part '3'.

I have no idea what FC302 is doing. That's where you come in... ;)

When the operator pushes the button to unclamp the chuck I want to send a pulse that moves the data from

-DB8001.DBW0 (198 bytes) which is a known DB that can be addressed directly, and move those 198 bytes into

-DB8001.DBW[whatever_part_operator_chose] (for 198 bytes). Which is a dynamic area that we won't know until the operator enters it on the HMI and clamps up the part (at which point I will have to put in logic the part that loads from 'whatever' area of the DB into DB8001.DBW0~198).

If DB8001.DBW52 is equal to part 36 then all of the data that is in

DB8001.DBW0 to DB8001.DBW198 (DB8001[0])

should be copied over to

DB8001.DBW7200 to DB8001.DBW7398 (DB8001[36])

with the value of '36' in DB8001.DBW7252 (for verification).

Thank you for your time. If there is an easier way to do all this, please let me know.

Thanks
 
Yes.

When clamping the data would be copied from DB8001[??... say 12] so DBW2400~2598 into DB8001.DBW0. But for that I would know the destination, just not the source until the number is entered. I just realized that I will be writing over DB8001.DBW52 so I may need to change that, but that is why there is also a DB8000, in case I need similar data but not making changes to it. or just call it something else altogether.

Initially all data coming into DB8001.DBW0 will be '0's but as the part gets ran more and more, the data will be populated.
 
In my mind, this is what I want to happen, I just can't get the destination to agree with me.


//for i:=0 to 198 do
//db8001.aiRunningData[(part#*200)+i] := db8001.aiRunningData
//end_for
OPN "100_pcs_array"
LAR1 P#DBX 0.0 //start of data transfer

L #iPartNumber //Part number for data to be transfered to
L 200 //Offset of 198 bytes for the next part
*I
ITD
DTR
T #dest
LAR2 P#DBX #dest



L 100 //would loop 100 times, moving 2 bytes at a time
xfer: T #iLoopCount
L W [AR1,P#0.0]
T W [AR2,P#0.0]
+AR1 P#2.0
+AR2 P#2.0
L #iLoopCount
LOOP xfer

I do not understand pointers, loops, AR1, AR2, P#0.0, xfer, STL, logic, color tv, what i am doing... goodnight
 
Try this blue adjustment:

-------
//for i:=0 to 198 do
//db8001.aiRunningData[(part#*200)+i] := db8001.aiRunningData
//end_for

TAR2 #dTemp32 //store contents
OPN "100_pcs_array"
LAR1 P#DBX 0.0 //start of data transfer

L #iPartNumber //Part number for data to be transfered to
L 200 //Offset of 198 bytes for the next part
*D
SLD 3
L P#DBX 0.0
OD

LAR2



L 100 //would loop 100 times, moving 2 bytes at a time
xfer: T #iLoopCount
L W [AR1,P#0.0]
T W [AR2,P#0.0]
+AR1 P#2.0
+AR2 P#2.0
L #iLoopCount
LOOP xfer

LAR2 #dTemp32 //Restore contents







Kalle
 
That moved data! how, I have no idea but it worked, thank you.

I need to work some bugs out of how the machine is running and getting more data into the part that is being ran. I will also need to be able to understand what you did enough to be able to go back the other way.

I.E.

Data from the part number that is entered (DB8001.DBW?? and 198 bytes of it).

into DB8001.DBW0 byte 198

Thank you for all your help smart people, I'll be in touch!!
 
Hello smart people!

I was able to get the data to go the other way by simply changing the AR1 and AR2 around.

I have changed the structure of my data and my space between parts is now 300 bytes (part 1 starts at DB8001.DBW300, part 2 starts at DBW600...).

What am I going to have to change to make this work?
//for i:=0 to 198 do
//db8001.aiRunningData[(part#*200)+i] := db8001.aiRunningData
//end_for


TAR2 #dTemp32 //store contents
OPN "100pcs_run"
LAR1 P#DBX 0.0 //start of data transfer

L #iPartNumber //Part number for data to be transfered to
L 300 //Offset of 300 bytes for the next part
*D
SLD 3
L P#DBX 0.0
OD

LAR2


L 150 //would loop 150 times, moving 2 bytes at a time
xfer: T #iLoopCount
L W [AR2,P#0.0]
T W [AR1,P#0.0]
+AR1 P#2.0
+AR2 P#2.0
L #iLoopCount
LOOP xfer

LAR2 #dTemp32 //Restore contents



and it doesn't seem to be working. One hitch may be that I am trying to move a date/time stamp data that each journal was ran and I'm not sure it is going to like that 8 byte block moved in small pieces.

Any help?

Thanks
 
Pseudocode and this line is opposite


L W [AR2,P#0.0]
T W [AR1,P#0.0]


Should it be?



L W [AR1,P#0.0]
T W [AR2,P#0.0]




As AR1 is now original data and AR2 is where you save.


Also as this is indirect addressing it would be advisable to limit iPartNumber (or AR and AR2) so that data won't point to data areas which don't exist on DB8001 block.

At least OB error blocks should used so that CPU never goes to halted state.
 
Sorry, snow day again...

To sum up:

Load part (1-100) in machine- move data from DB8001.DBW(x*300) into DB8001.DBW0 for 298 bytes of data (AR2 --> AR1).

Initially all data will be 0. Roll crankshaft and collect average roll forces for any journal that has been ran while chuck is clamped.

Unclamp chuck, move data from DBW0 to DBW(part#*300). DB8001 is an array of 100 parts, with 298 bytes of data per part (AR1--> AR2).

Put part on a rack, part may come back to the machine up to 4 times. We may roll Main 1 on all parts (rolling main 1 is using a tool that only has one roller in it, the rest of the journals use a tool that uses 2 rollers). Then start with part 1 again and run Mains 2,3,&4. Put part back on rack, run all parts and then start back at part one and roll the pin journals.

At the end of it all I would like one DB that holds all the data together that will easily show that the entire part has been ran, time and date stamp of when the journal was rolled and average roll forces used. This will then be output to CSV file for tracking and printout to customer.

When I had the program that was last edited by Kalle (the 200 byte one) it worked. I ended up changing the data that I wanted to collect and re-organizing the block, this gave me a part profile that has 298 bytes of data. I tried to change the numbers from 200 to 300 (byte #) and 100 to 150 (moving 2 bytes at a time) and it isn't working.

The only other thing I can think of is it doesn't like the format of the DATE_AND_TIME variable that I am trying to capture.

//for i:=0 to 298 do
//db8001.aiRunningData[(part#*300)+i] := db8001.aiRunningData
//end_for


TAR2 #dTemp32 //store contents
OPN "100pcs_run"
LAR1 P#DBX 0.0 //start of data transfer

L #iPartNumber //Part number for data to be transfered to
L 300 //Offset of 198 bytes for the next part
*D
SLD 3
L P#DBX 0.0
OD

LAR2


L 150 //would loop 150 times, moving 2 bytes at a time
xfer: T #iLoopCount
L W [AR1,P#0.0]
T W [AR2,P#0.0]
+AR1 P#2.0
+AR2 P#2.0
L #iLoopCount
LOOP xfer

LAR2 #dTemp32 //Restore contents

Thanks.
 
''The only other thing I can think of is it doesn't like the format of the DATE_AND_TIME variable that I am trying to capture.''

It will copy any format, OK.

---

Put in a fixed part no, f.x. 1, and run the code continuously to check if it copies.
 
After changing the data in DB8001 I had not changed the input to the 'data out' block... updated that so it would set the pointer to the correct spot and it works... probably why I never went pro.

Thanks!!
 

Similar Topics

Hey Guys! Wondering if anyone here knows if it's possible to address area blocks in a PLC via pointers in WinCC Flexible. I need to...
Replies
6
Views
4,512
What I need to do is be able via code suitable for S70-315DP ( STL, LAD etc) to store a base address eg PIW 216 and then read the next 8 addresses...
Replies
9
Views
13,060
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
230
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
762
Back
Top Bottom