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.

Why are variables not valid as channel IDs?

Nico May 1, 2021 06:58 AM

Why can't CRbasic allow iterating over VoltDiff or VoltSE channels?
Why can't the AM25T instruction allow iterating over channels?

The technical question is - why does CRbasic insist on a Constant for selecting the Channel instead of a Variable?

Why is the underlying software/firmware not more robust and if the channel ID during runtime isn't available (or doesn't make sense) the measurement instruction returns NAN for example?

This is what I'd like:

For i = 2 To 5 Step 1
TCDiff (T(i),1,mV2_5C,i,TypeT,T_Logger,False,0,250,1.0,0)
Next i 

Please note that I'm fully aware that this exists:

TCDiff (T(2),4,mV2_5C,2,TypeT,T_Logger,False,0,250,1.0,0)

But it doesn't allow me to specify to time those measurements at another time interval than the Scan or SlowScan loop is running at (as far as I'm aware), i.e. if I want to control the sequence of measurements and their timing sequentially, but also do not want to write out every single damn measurement like so:

If i > 1 OR i < 6 Then
If i = 2 Then TCDiff (T(2),1,mV2_5C,2,TypeT,T_Logger,False,0,250,1.0,0)
If i = 3 Then TCDiff (T(3),1,mV2_5C,3,TypeT,T_Logger,False,0,250,1.0,0)
If i = 4 Then TCDiff (T(4),1,mV2_5C,4,TypeT,T_Logger,False,0,250,1.0,0)
If i = 5 Then TCDiff (T(5),1,mV2_5C,5,TypeT,T_Logger,False,0,250,1.0,0)

If one does such measurements via a multiplexer its easily possible and all of a sudden CRbasic doesn't care in the slightest to what source those channels are being switched to.. but I really don't see a reason why I have to jump through hoops of manually advancing multiplexer channels.. (AM25T example, Diff #1 on logger being used):

For i = 2 To 5 Step 1
PortSet(2,1) ' start AM25T For p = 1 To i Step 1 ' advance to next channel by pulsing twice PulsePort(1,0) PulsePort(1,0) Next p TCDiff (T(i),1,mV2_5C,1,TypeT,T_deltaRef,False,0,_50Hz,1.0,0) PortSet(2,0) ' turn off AM25T
Next i

when it could be so easy: 

For i = 2 To 5 Step 1
  AM25T (T(i),1,mV2_5C,i,1,TypeT,TRef,2,1,0,False,0,250,1.0,0)
^ Next i

I'm also aware of SlowScans.. but they don't allow me to ALIGN measurements/actions from different scan loops as far as I'm aware.

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