You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old January 17th, 2018, 01:16 PM   #16
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is online now
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,329
Argh, I read it as you would clear the temps at the end of the block.
Sorry for the confusion.

__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old January 17th, 2018, 08:39 PM   #17
kalabdel
Member
Canada

kalabdel is offline
 
Join Date: Feb 2015
Location: Ontario
Posts: 341
Quote:
Originally Posted by L D[AR2,P#0.0] View Post
Yes, I remember reading it as well but couldn't find out where.

Programming Guideline. A must read.

Section 3.2.2 and 3.2.3
"Temporary tags are undefined when called in non-optimized blocks. In
optimized blocks, the values are always preset to the default value (S7-1500
and S7-1200 Firmware V4). Thus, the resulting behavior is not accidental but
reproducible. "
  Reply With Quote
Old January 17th, 2018, 09:16 PM   #18
kalabdel
Member
Canada

kalabdel is offline
 
Join Date: Feb 2015
Location: Ontario
Posts: 341
Quote:
Originally Posted by JesperMP View Post
Argh, I read it as you would clear the temps at the end of the block.
Sorry for the confusion.


That's because he did, at some point.

Quote:
Originally Posted by [PL] mk View Post
The temp memory is global and is not cleared when exiting the function.
  Reply With Quote
Old January 20th, 2018, 05:22 AM   #19
[PL] mk
Member
Poland

[PL] mk is offline
 
[PL] mk's Avatar
 
Join Date: Apr 2017
Location: src
Posts: 16
I mean, that temporary memory is available after exiting the function and if in the next called block there is no assignement and the variable is declared in the table and used in the program, a strange things can happen.
There may be problems of this type when several programmers are working on the project, especially young and unexperienced.
Something will be copied, not be assigned and he is supprised that it does not work.
Clearing temp after invoking the function eliminates this problem.
Since I use it I dont have problems with that.
Maybe it is wrong or maybe not, but that is how I do it. And it works
  Reply With Quote
Old January 20th, 2018, 05:56 AM   #20
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 5,553
Clearing the temp area may be giving others the impression that it is ok to use temp variables without initialising them. What makes initialising them to zero any better than any other value?
  Reply With Quote
Old January 20th, 2018, 10:53 AM   #21
Lare
Member
Finland

Lare is offline
 
Join Date: Jan 2006
Location: Finland
Posts: 1,035
Quote:
Originally Posted by [PL] mk View Post

I have never said that I clear temporary memory when exiting a block. I do it in the first step after block is called.
Is there need of zeroing after all, if you don't initialize temps anywhere on block?

You can only use temp data after some logic is updated temps before inside your block.

And if you read temp data before you put "new" data on block to them, them temp data is = 0 (zeroing) or data from elsewhere of program (on both situations it is useless/wrong data)


Zeroing temp maybe helps on online edits of strange things to happen situations, but it certainly don't repair coding errors of reading from wrong variables

Last edited by Lare; January 20th, 2018 at 11:03 AM.
  Reply With Quote
Old January 20th, 2018, 09:58 PM   #22
kalabdel
Member
Canada

kalabdel is offline
 
Join Date: Feb 2015
Location: Ontario
Posts: 341
Quote:
Originally Posted by L D[AR2,P#0.0] View Post
Clearing the temp area may be giving others the impression that it is ok to use temp variables without initialising them. What makes initialising them to zero any better than any other value?
Known vs unknown value.

If temp > zero do this otherwise do nothing.

OR

Total = Temp1 + Temp2
If total = zero then error.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Unity Pro XL DTM Browser Issues 00sas00 LIVE PLC Questions And Answers 10 October 29th, 2012 05:56 PM
Need help with SCL REPEAT structure chauvinhloi LIVE PLC Questions And Answers 4 May 31st, 2012 07:30 AM
[Beckhoff] Declaration of structure to address Bridelance LIVE PLC Questions And Answers 6 January 28th, 2012 03:16 PM
S7 any pointer using struct in TEMP area dahnuguy LIVE PLC Questions And Answers 31 May 31st, 2011 11:43 AM
installing a panelview 600 + rjmarinaro LIVE PLC Questions And Answers 10 June 17th, 2008 11:52 AM


All times are GMT -5. The time now is 06:55 AM.


.