Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Looped Sampling


JonathanT Sep 19, 2014 07:00 PM

Hi,

I'm curious as to why the CR1000 compiler treats For-To-Next loop with the DataTable Sub as a conditional statement and refuses to compile. For example,

///
DataTable (MyDataTable,1,-1)
Sample (1,batt_volt,FP2)
For i = 1 To 10
Sample (1,MyArrayOfDataType1(i),FP2)
Sample (1,MyArrayOfDataType2(i),FP2)
Sample (1,MyArrayOfDataType3(i),FP2)
Next i
EndTable
///

generates error upon compiling: "Sample cannot be used within a conditional statement".

Using sample in this way would be elegant for generating descriptive field names and scaling data table sizes.

Cheers,

Jonathan


JDavis Sep 29, 2014 08:01 PM

There are some rigid rules enforced on data tables. These rules are needed since the datalogger needs to partition memory at compile time to handle final storage.

You will notice that all of the output processing instructions have a repetition parameter to preclude the need for a loop.

Log in or register to post/reply in the forum.