Internet PLC Forum

General => Technical support => Topic started by: oes on September 21, 2007, 03:03:31 AM

Title: PIDCompute
Post by: oes on September 21, 2007, 03:03:31 AM
I'd like to call PIDCompute for 7 different channels in a for-next loop, something like this:

for I = 1 to 7
     E= ... 'Determine the error
     T=PIDCompute(I,E)
next 'I

I get an error each time I try to compile.  When I take the PIDCompute out of the loop and call the function with a channel number (rather than a variable, I), I get no error.  for example:

T=PIDCompute(1,E)
works OK.

I'd like to call the function in a loop with the channel indexed.  Is that not permitted?
Thanks!
Title: Re:PIDCompute
Post by: support on September 21, 2007, 10:44:37 AM
Some parameters used by TBASIC have to be integer constant and not variable due to the the way data are stored inside the PLC. i.e. some data may be stored during compiled time and not during run time and therefore the location of the data must be known during compilation. In such circumtances TRiLOGI compiler will not allow the parameter to be a variable.