Step7 - anybody any idea whats going on here?

RMA

Member
Join Date
Sep 2004
Location
North of Hamburg, Germany
Posts
2,052
I've now managed to persuade the powers that be to stop trying to turn me into an electrician and let me get back to playing with my favourite toys. So now I'm back with the first question!

We've got three pumps here which for reasons unknown to me have an autarch C7 based control system.This means that it is not possible to integrate the pump data - winding temperature, water pressure and water level, into the HMI visualisation. In order to get round this problem they want to integrate the three pumps into one of the existing S7 PLCs - that's my job.

Unfortunately the supplier of the pumps wasn't prepared to release the source code, but for some reason they were prepared to give a dump of the code from a similar (identical) installation - i.e. no comments or symbols.

The actual control is pretty simple but the pump is controlled by a Siemens Masterdrive unit (which I've never met before). There are two FCs which I believe handle the Masterdrive, FC20, which is purely a communications block sending and receiving data using SFB12 and SFB13. At the end of this block FC21 is conditionally called if the NDR Bit of SFB13 is set and this is where I'm having my problems!

I'll hang the code on at the end of this post. Just a few points, I haven't yet received my new laptop with Step7 so all I've been give is the sources as text files - in German notation of course! For those who don't know it the command equivalent are as follow:

Code:
D	GB
U	A
O	O
SPB JC
SPBN JCN
AUF OPN(?)
SPA JU
ZV CU

My main problem is with this bit of code which occurs about half way through after label M006:

Code:
M006: NOP 0; //Arrive here first time through
	 L	 MB 312; 
	 L	 B#16#1; 
	 ==I ; //at last this time it's TRUE
	 SPBN M007; 
	 AUF DB	 2; //so carry on here
	 LAR1 MD 320; //Pointer = DBX224.0 first time through = STAT113
	 L	 DBW [AR1,P#0.0]; //Initial Value = 0
	 T	 MW 400; 
	 AUF DB	12; //---- THIS IS WHERE IT GETS WEIRD ---
	 L	 B#16#11; 
	 LAR1 MD 324; // = DBX2.1 ???
	 T	 DBB [AR1,P#0.0]; //???
	 L	 MD 324; 
	 INC 8; 
	 T	 MD 324; 
	 L	 MW 318; 
	 LAR1 MD 324;

The comments are all my thoughts as I tried to work my way through, so if I've made a wrong assumption or interpreted something incorrectly, I'll be glad to here it! Just as a side note MW 318 is not initialsed anywhere in the program - neither as Bytes nor as part of a WORD or DWORD, so first time through it's actually undefined - not nice!

What's the command to keep the formatting,
Code:
 only sort of seems to half work. Oh, I see the problem extra spaces and tabs are getting lost, ah well, it should be a bit more comfortable in the txt file!
 
Here's FC21 using english instructions if it's any help.

I can't see how you get MD324=DBX2.1
It gets loaded from DB12.DBB1 and then SLW 3 is performed - so this will always ensure it will be x.0
All following instructions are either INC 8 or INC 16 or INC 32 thus ensuring MD324 is on a byte boundary.
 
Last edited:

Similar Topics

good day everybody pls is there anyone kind hearted to share how to protect FB,FC,SFC,SFB,OB. what i mean KNOW_HOW_PROTECT features in step by...
Replies
11
Views
7,229
This is the first time I am working with Simatic Manager Step7 as I started my siemens journey with TIA which is pretty easy and do a lot of stuff...
Replies
3
Views
142
When you download a DB, the values get overwritten by what is in the "actual" column in offline DB. Does this happen at the start of the PLC...
Replies
6
Views
142
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
128
Hi all, I am trying to convert RSLogix 5000 program to Step7. I need to bit shift left my array of double integers for tracking the product on...
Replies
2
Views
520
Back
Top Bottom