S7 Code problem

RheinhardtP

Lifetime Supporting Member + Moderator
Join Date
Oct 2004
Location
Perth
Posts
562
Hi Guys the following is software that i use for tracking of data, when i want to delete a record i make the value palletid 0.

The problem is that the code does not always clear the palletid. Can anybody see anything that might be causing havoc on my tracking managament system..

My buffer eventually fills up and i have to clear it manually.

Thanks in Advance

Network 1 - If not pos edge then goto end
A(
L #RecNo
L 1
>=I
)
A(
L #RecNo
L 200
<=I
)
A #Trigger
AN #HIS_Trigger
JCN END
Network 2 - Setup record lengths
L 120
T #tRecBytes
L 84
T #tProdBytes

Network 3 - Get tracking data into local copy
L #RecNo
+ -1 //Get rid of offset
L #tRecBytes //bytes per item
*I
SLD 3 //convert to pointer
LAR1 //Save in address register
T #RecStartAdd
LAR1 P##Source //--Set up ANY pointer for source
L W#16#1002 //Data type header (see definition for ANY data type)
T LW [AR1,P#0.0]
L #tRecBytes
T LW [AR1,P#2.0] //no of bytes
L 81
T LW [AR1,P#4.0] //DB No
L #RecStartAdd //Start add
L P#DBX 0.0
+D
T LD [AR1,P#6.0]
CALL "BLKMOV"
SRCBLK :=#Source
RET_VAL:=#Return_Val
DSTBLK :=#Record
Network 4 -- Delete Record if requested
L #Record.Data.PalletID
T #PalletID
A #Delete
JCN END
LAR1 #RecStartAdd
OPN "TrackingData"
L L#0
T DBD [AR1,P#2.0]
Network 5 -- End
END: NOP 0
A #Trigger
= #HIS_Trigger


Rheinhardt
 
I didn't see nothing wrong in this code. But "code does not always clear the palletid" seems questionably. May be problem is in #Delete and #Trigger triggering, not in indirect addressing?
 
Thanks

Thank you for your reply..

I thought that would be the case it is not consistent and im leaning towards the fact that it is the trigger and that operator intervention is causing the problem

tHANKS AGAIN

Rheinhardt
 
The only thing I can see, what is #Record, for the block move it should be ANY, later you L #Record.Data.PalletID, which makes me guess that #Record is a UDT in the temp range.


So you have pulled a copy (before clearing the palletID) from the DB into the TEMP UDT. After you have done this, you clear the the pallet ID in the DB direct.

Do you then later put the TEMP UDT #record back with another block move?? This will not have the cleared bit if you did.


I've never used a TEMP UDT direct like that, I'm a little skeptical, unless of course its a STAT in an FB perhaps. If its a TEMP you have to change the data type to 87 (previous temp area).
 
Last edited:

Similar Topics

I'm starting learning ladder programming. I bought the FX3U kit + coolmay HMI from aliexpress. I'm doing basic testing and uploading codes. I...
Replies
35
Views
2,220
A particular T/C module was only using ch2. I updated it to also use ch1 and ch3 (1st and 3rd channel). I don't even know what D114.1 means but I...
Replies
5
Views
2,318
I have ignition running on a PC. There is a barcode scanner app from Sepasoft that allows an PC running ignition to accept barcodes. It costs 500...
Replies
1
Views
2,697
I am trying to check what is the value coming from the pot and depending on the value change the value inside the DB11.DBD0 But it is not working...
Replies
24
Views
3,225
Hi guys . Im trying to monitor gas detection controller Vortex model from Crowcon /UK on Citect SCADA by modbus RTU RS485 . Reading analog value...
Replies
0
Views
1,733
Back
Top Bottom