Step7 - Peculiar behaviour when viewing Block online

In net 1 you say that you cannot explain why it does work.

Simon explained it in message 19 (not 30), I don't know if this is true but I have no reason to disbelieve.

MESSAGE #19 (warning this is a repeat)

Concerning FC's and output variables - it all depends on the data type passed. If its an elementary type (e.g. M0.0), the output parameter's area pointer points the the actual parameter. If however, it's a fully addressed operand (e.g. DB1.DBX0.0), the output parameter's area pointer points to the V area. If the V area has not been assigned, then you may get spurious results.

Summary: Set and Reset of an FC OUT variable will work provided it's not a fully addressed variable. Using an M flag is ok. Using DBx.DBXy.z is not ok.

END OF MESSAGE #19




I for one will continue to use IN_OUT's to avoid confusion and to ensure future software works. (a great time bomb for someone adding things).

RMA - You started something here :mad:
 
Hi Peter,

Simon's absolutely correct, it's buried deep in a Siemens FAQ here:

http://support.automation.siemens.com/WW/view/en/189227

But I was originally taught the same as you outlined above (probably the same Siemens engineer!)

After some commissioning problems on a job, I eventually found the FAQ above.

I also now pretty much tend to use IN_OUT's in FC's - just to be sure....


Kevin H
 
Sorry I'm a bit late back in the loop folks, I'm under a bit of pressure to get the manual controls finished so that the commissioning guys can start checking out the cabling and equipment on site next week, so this one's gone down in priority.


To keep it short,

Peter, for some reason your program wouldn't compile, even after I changed the commands back to German - it didn't recognise the VAR definitions. I finished up typing in by hand but it still didn't work - having reread the Thread, this presumably because all the I/O is going to fully addressed DBs. Looks like I'll have to park things in Markers in between.

Rolf, I don't think the enable signal is a problem. The program is run as two parallel paths, which one is executed depends on whether the input level in the tank is above or below the MAX alarm limit (GW3). The state of this is determined right at the start by a compare and the result stored in the TEMP. Actually, since the paths are completely separate and accessed and left by Jumps, the use of the TEMP is actually redundant, but I tend to be a belt and braces type :). Removing it didn't make any difference.
 
RMA said:
Peter, for some reason your program wouldn't compile, even after I changed the commands back to German - it didn't recognise the VAR definitions. I finished up typing in by hand but it still didn't work - having reread the Thread, this presumably because all the I/O is going to fully addressed DBs. Looks like I'll have to park things in Markers in between.

Sorry I don't have testing fascilities here, the code has a small error.

this part....

Code:
	 L	 #SW_Pau // If OFF time complete
	 >I	
	 S	 #Impuls // turn ON Impuls and Clear pulse count
	 JC	Clr	 // and jump to Clear pulse count
 
OFF: L	 #SW_Imp // If ON time complete
	 <=I 
	 BEC


should read.....


Code:
	 L	 #SW_Pau // If OFF time complete
	 >I	
	 S	 #Impuls // turn ON Impuls and Clear pulse count
	 JC	Clr	 // and jump to Clear pulse count
	 BEU
 
OFF: L	 #SW_Imp // If ON time complete
	 <=I 
	 BEC


missed the BEU after the JC Clr!!!! ooops

EDIT:

'having reread the Thread, this presumably because all the I/O is going to fully addressed DBs'

No its my mistake above. The IN_OUT will work no matter what the data type is, its th OUT thats questionable. I did mention that I felt maybe that is why your customer had it working before, perhaps they used M flags and the OUT will work with them!
 
Last edited:
Roy - PeterW's code compiled ok as is in English.

I switched to German (Step 7 restart required), imported your code, compiled it, then switched back to English. Suggest you switch back to English if you want to import English code rather than typing it in !
 
Peter, I've added the BEU and sure enough things are looking better, but still not quite perfect. I'm back at a stage where I was earlier.

The "Pause" delay time is now working correctly and displaying the value from #IW, but the program is not outputting the Impulse for the number of seconds defined in SW_Imp, instead it appears to be outputting a pulse only for a single cycle. I can get it to push a counter up every time it comes, but the output Bit blinks only occasionally.

Simon, didn't think of that! I don't use that option very often!
 
Hello,

I had a similar problem a couple of months ago. I had a project that needed 20 pulse-pause timers that all needed to be adjusted independend. I also did not want to use up so many timers. Instead, i wrote a simple PP-generator program that uses SFB4 (TON). It can easly used as multiple instance DB so you only need 1 DB for all the time info.
it is connected as follows:
inputs: start (BOOL); pulsetime (TIME); pausetime (TIME).
Outputs: pp-out (BOOL); actual time (TIME).

I have included an exampleproject that uses my PP generator. everyting can be controlled in the variable table.

Bert
 
In Network 3 of FC164, you reset "K1_FG_takt" and then jump to JC Entl, at Entl, providing #L4018_gr_GW3 is off, you jump to FC413.


As "K1_FG_takt" = Ein, in this condition you will reset IW!!

Can this be happening.
 
I thought you might have got the answer there, Peter, but unfortunately, it's not.

In fact I'm running two versions of FC413, the original, which I've posted here and a modified version which counts backwards so as to display the remaining "Pause" delay on the panel. Each runs in the opposite case, i.e. one runs when the tank level is < MAX and the other when Tank levvel is > MAX. In the course of playing around I've moved things around a bit so that the situation is that the #EIN input for your version of the counter is running under the configuration as shown in the original screen dump and is enabled by #K1_FG_Takt_Entleerung which is enabled by the condition tank level > max. This may be different from the source code i POSTED. But in fact, as running, that code is OK.

I've now got a little spare time, so I'll have another look and see if I can suss out what's happening.
 
Last edited:
Peter is correct, if you are calling the case for "Taktung für Fall - Entleerung", Ein will always be false and hence wont do anything.

I have replaced all the symbol names with flags to get this code working and I'm puzzled by the variable "BT6.4s" which is referenced in OB1 to generate a one-shot. I can't find where this variable is being controlled but guess its a one second pulse.

Posted at the same time as RMA's last post !
 
I can't find where this variable is being controlled but guess its a one second pulse.

I thought I'd also posted OB1, but your right, it's bit 5 of the frequency generator Byte in the CPU, MB1 in this case. Where on earth the name came from is anybody's guess!

I've subsequently discovered the original S/W was written by somebody on site, during commissioning, so maybe it's not too surprising it's a bit weird!

The strange thing is that Peter's code doesn't change from comparing the #IW current count with #SW_PAU, the Pause time, to comparing it with #SW_Imp, the Impulse time. The counter always runs to 10 secs instead of alternating between 10 and 5 secs, which are the values I'm using at present. This is also happening with my backward counting, modified, version of the original FC (with Impuls as IN_OUT).

So far, I haven't been able to fathome out why.
 
Last edited:
I've tested my block and it works OK (On and Off), others have tested the original block (OUT to IN_OUT the only change neccesary) and said it works OK.

It has to EIN, its the only thing.

The problem with these problems is you don't have time to see them, so TRAPS ahoy.

Use a couple of spare flags and ensure you don't lose "K1_FG_takt" or turn on #L4018_gr_GW3. [Edit: by setting flags from these, ensure they're off first of course]

Also the comparison is >R and <R, stupid question, but are both variables actually REAL format.

The answers in the Ein!!!
 

Similar Topics

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
157
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
152
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
144
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
528
I have a word in some DB which I want to load to AR1 and use as a pointer. In order to do this I need to write L DBxy.DBW xy SLD 3 LAR1 I...
Replies
3
Views
544
Back
Top Bottom