PLUS+1 Hardware > Controllers


(1/2) > >>


I am using POU with structured text ST as you see in my example.
I do average of some numbers.
Like you see when I use Retain Variable I have problem as you see in picture.

Please could you tell me where the problem

Thanks for your help

With best regards

You've got a colon instead of a semicolon at the end of your first RETAIN variable declaration.

Hi Tom,

Tank you very much to replay me.
But I didn't understand.  Please could you give more detail. Or Correct example.
I am not familiarized with POU ST

Thanks in advance.

With best regards

HI Tom,

Sorry Tom It's ok but now I have another problem. Please see image.

My function is working without VAR RETAIN but the result is not good.
As example When NbIncrement_Scan =1 the output is equal to input. It's Ok.

But when My NbIncrement_Scan est >1 then the output is equal to zero.

That's why I tried to use VAR RETAIN.

I hope you understand my problem.

Thanks in advance for your help

Best regards

If you want to keep the valve of NbIncrument and CounteurIncrement between calls use a Function Block instead of a Function.

A Function does not store the valve of it's variables between calls so each time the function is called NbIncrument and CounteurIncrement will always be initialised to 0.  A Function Block will store the value variables.


[0] Message Index

[#] Next page

Go to full version