PLUS+1 Hardware > Controllers
Static variable in POU
(1/1)
macbahi:
Hello,
I try to use POU structured text.
Please I want to use static variable as in C programming.
as example static double var1 =0 (initialized to zero but it can be changed after in the program)
Thanks in advance
With bests regards
macbahi:
Hi
I have using this PLCcode but not working with plus1
VAR_STAT
var1 : INT :=0;
END_VAR
Thanks
Tor:
Hello macbahi,
I'm not a ST or C coder so I asked around and this is what I got.
"If the customer makes his POU a FUNCTION_BLOCK then the value of ordinary VAR variables will be kept between the calls, just like a static in C-code
ie:
FUNCTION_BLOCK MyBlock
VAR
var1 : INT := 0;
END_VAR
"
I hope it helps.
macbahi:
Hi Tor,
Ok .
Thanks
With best regards
mac bahi
Navigation
[0] Message Index
Go to full version