Logging on Timing Pulse


Recommended Posts

I am involved in a project to take radiometric measurements as a vehicle is driven using a LabJack U3 and DAQ Factory express. We need to record the data at a set distance interval using the speedometer pulse, as the vehicle speed will be variable. How do I write s script to log the current A-D reading at a pulse? We have to do it this way to correlate a specific reading to a specific point. The data is coming in perfectly well on channel 3, and I can use any other channel for the pulse. I understand I will have to set up some sort of event, but I need the specifics. I find writing scripts confusing, and usually fail several times before I get it right.

Thgank You,

Bill

Link to comment
Share on other sites

The easiest way is to use an export set to log a single line. Create an export set and put the names of the channels you want logged on trigger with [0] at the end. You can test the export set by manually starting it from the workspace.

Then you need some event script. Lets assume your digital channel is called trigger, and export set is called myexport. The event would go with the trigger channel:

if ((trigger[0] == 1) && (trigger[1] == 0))
   beginexport(myexport)
endif

The only problem is that you might get the reading before the trigger if the input is timed to read shortly after. You can get around this in two ways:

1) make your script:

if ((trigger[0] == 1) && (trigger[1] == 0))
   read(input)
   beginexport(myexport)
endif

2) put the event in the input channel's event instead. This only works if the input channel and trigger channel are read at the same Timing interval.

Link to comment
Share on other sites

Archived

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