how to get time into a channel when using Mychannel.addvalue


Recommended Posts

i have been using 2 labjacks simultaneously with DaQF_express. in evaluation.

the approach i took was to use a hybrid of the channel table and scripting sequences.

-- channels are declared in table but device type is "test", and timing is "0".

-- then, in sequence script i have a timing loop (a while loop) which executes

1. eGet command for A2D and timer values

2. mathematical manipulations as needed

3. MyChannel.Addvalue(value) where the name "MyChannel" is one of the Channel names in the channel table.

BUT -- and maybe this is obvious -- the time stamp of the value is not placed into the MyChannel array. It simply gives the same time value to all of the data entries. and this time value seems to be the time at which the Channel was created.

please advise on how to get the { data value , time value } pair entered into the Channel record for each eGet call.

Link to comment
Share on other sites

for more completeness, this is the final result --

// LPTank_Pressure is a channel name defined in the Channel Table with device = "Test" and timing = "0"

// Device "Dev7_SW" was Opened in a startup sequence before this sequence was started.

Go_Channel_Read = 1

while (Go_Channel_Read)

//snippet for reading channel LPTank_Pressure[]

err = eGet (Dev7_SW, LJ_ioGET_AIN, 0, @channelval7, 0)

channelval7 = channelval7 * PressureConv1000PSI10V

// LPTank_Pressure.AddValue(channelval7) -- replaced this with the following line

LPTank_Pressure.AddValue(insertTime(channelval7, sysTime(), 0))

// many more similar lines for other channel reads...

delay (0.2)

endwhile

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.