S7 Code explanation

arocon

Member
Join Date
Oct 2006
Location
Dubai
Posts
171
Could anyoone explain the following S7 statement code:

// table ID will be zero if none are found
CALL "MinLoadingNumber"
Loading_Order :="GlobalData".Loading_Order
Min_Loading_Number:=#Min_Loading_Number
Table_ID :=#Table_ID

// if the table ID is zero or the min loading
// number is not 1, we have no coils to load
// for processing
L #Table_ID
L 0
==I
SPB LBE
L #Min_Loading_Number
L 1
<>I
SPB LBE

// we have a table with a "1" for loading
// so we get the pallet db for that table
// and double check the data
CALL "DBFromTableID"
Table_ID :=#Table_ID
Pallet_DB :=#Pallet_DB
Pallet_Exists :=#Pallet_Exists
Coil_On_Pallet:=#Coil_On_Pallet

L #Pallet_DB
L 0
==I
SPB LBE

// check that the pallet is registered in the
// system and that it has a coil
U #Pallet_Exists
U #Coil_On_Pallet
SPBN LBE

// if the table is in auto mode and started
// mark the coil for movement onto the shifting car
CALL "RTOffsetFromID"
Table_ID :=#Table_ID
RT_Int_Offset:=#RT_Int_Offset

// RT Int Offset is zero if no interface is found
L #RT_Int_Offset
L 0
==I
SPB LBE

L "GlobalConstants".RT_Int_DB
T #RT_Int_DB

AUF DB [#RT_Int_DB]
L #RT_Int_Offset
ITD
SLD 3
LAR1

// check that pallet db and table id match
// pallet db is 10
// table id is 12

L DBW [AR1,P#10.0]
L #Pallet_DB
<>I
SPB LBE

L DBW [AR1,P#12.0]
L #Table_ID
<>I
SPB LBE

// auto mode is 19.5
// auto run is 21.5
// drive run is 18.0
// drive running is 18.1
U DBX [AR1,P#19.5]
U DBX [AR1,P#21.5]
UN DBX [AR1,P#18.0]
UN DBX [AR1,P#18.1]
SPBN LBE

// Mark pallet for the shifting car
// Next stop is 0
// Final stop is 2
// Pallet direction is 12.1 (1= north)
AUF DB [#Pallet_DB]
LAR1 P#0.0
// read needed coil data
// 42.0 is bypass prep
L DBW [AR1,P#42.0]
T #Bypass_Prep
L "GlobalConstants".Pallet_DB_Offset
ITD
SLD 3
LAR1
AUF DB [#Pallet_DB]
L 9
T DBW [AR1,P#0.0]
L #Bypass_Prep
L 0
==I
SPB PREP
L 10
T DBW [AR1,P#2.0]
SPA DIR
PREP: L 10
T DBW [AR1,P#2.0]

// south tables need to go north, south tables
// are odd numbers
DIR: L #Table_ID
SRW 1
SPP SDIR
CLR
= DBX [AR1,P#12.1]
SPA LBE
SDIR: SET
= DBX [AR1,P#12.1]

LBE: NOP 0

Thanks
 

Similar Topics

Dear Experts, Need help understanding this SCL code . IF (#SimOn = 0) THEN IF (#DI_In <> #Mem) AND (#Mem1 = 0) THEN #RemTime := #Tf...
Replies
4
Views
1,569
Could anyone please explain me what is doing the following code: // set BR =1 SET SAVE // check for a valid DB number L 0 L...
Replies
3
Views
1,963
Hi All, Someone at work has put a PLC system on my desk, that's just been taken off an idle production line. He said "It's an S7 PLC. We don't...
Replies
10
Views
185
hello, I'm a student and for my final grade I have to repare a sepro robot. the only problem I have for now is that i have an error code 3...
Replies
0
Views
35
I received an email from a student with the following code attached. This is supposed to control a floodgate system, and supposed to be written...
Replies
23
Views
778
Back
Top Bottom