Channel group, Main channels interplay

Recommended Posts

I have Main channels, a1 to a4, on channels 0 to 3. I have group T1 channels, t1 to t3, also on channels 0 to 3. So Main and Group T1 are using same physical channels.

I set Main channels to 1 sec timing. I set Group T1 channels to 0 timing. I get no error messages doing this. I have a table to display T1 channel values in 4 cells. Each cell shows value at a certain history point. I use a delay in the sequence, then Channel.ReadGroup("T1") to create the history at that point.

But. The channel timing on Group T1 does not act as 0. It acts as 1 second timing.  Is that just the way it is if you try and use the same physical channels across groups? The timing column being a hardware trigger as well as history update? Having T1 group set to 0 timing is over ridden? As well as the history entries being 1 second based?

My goal is to have current value per second in one cell of the table. Historical interval values in the other cells. So Main a1 at 1 sec intervals, t1 interval samples in other cells.

In the table cell expression to display the history value of a group channel, is t1(10) correct to show 10th history value. Or a specific group reference command?

Using a Labjack U6-Pro by the way.

Link to comment
Share on other sites

The problem is that when the data comes back from your a1-a4 reads it is not put into channels by name, but rather the data is put into any channel that matches the device type, device number, I/O type and channel #.  So, when a1 reads, the result is put in both a1 and t1.

Really you just need to write a little script and not trigger a second read.  Make t1-t4 Test channels, still with timing of 0.  Then, create a sequence that copies the data over:

private clist = channel.listall("Main")
for (private i = 0, i < numrows(clist), i++)
   execute("t" + (i + 1) + ".addValue(a" + (i+1) + "[0])")

Then run this sequence every time you want the T channels to update with the latest reading from  the A channels.  Note that your numbering of channels from 1 makes this slightly more confusing, so you might consider sticking with the computer standard of numbering from 0 (a0, a1, a2, a3...)

t1(10) technically means call a function called t1 passing the value 10.  However, if t1 is a variable it will do the same as t1[10], at least in the present version of DAQFactory.  This is  an undocumented offshoot of the script parser and not guaranteed to remain, so really you should get into the habit of using [] for subsetting and () for function calls.  That said, remember, DAQFactory, like most every programming language, numbers from 0, so t1[10] actually returns the 11th value.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.