I have two tasks. Each uses a constant value initialized in task1:
CONST num sizebuffer := 1000;
I need to use this constant value in task2. Problem is, I have to declare sizebuffer in task 2 in order to compile. But the compiler refuse just to initialize the variable without value
CONST num sizebuffer;
Syntax error(135): Expected ‘:=’
If I initialize the sizebuffer in task2
CONST num sizebuffer := 1000;
The program compile. But the value can be different if it is initialized differently in the two tasks! How is it possible to fix that?
Thank you for your answer. I forgot to mention, the variavle sizebuffer is used to specify the size of an array of jointtarget.
CONST num sizebuffer := 1000; ! Size of the cyclic buffer
PERS jointtarget cyclicbuffer{sizebuffer};
RAPID programming does not allow to use non-constant variables to specify the size of an array; using PERS num nSizeBuffer:=1000 thus generate an error. How can I specify the size of an array so that the variable containing the size of the array is only initialized once for multiple tasks^