Sign in to follow this  
AndrewSlater

Synchronising Streams

Recommended Posts

Hello,

I am currently using a Labjack U12 with DAQFactoryExpress.

I wish to set up a single repetitive DA channel waveform of the form

time 0

DAOutput = 1

time 0.08

DAOutput = 2

time 0.2

DAOutput = 3

time 0.5

goto (0)

I also wish to sample a differential AD input at times within this sequence.

However I am limited to 10 lines of sequence with DAQFactoryExpress.

If I write a seperate stream that does

time 0

read(ADInput)

time 0.08

read(ADInput)

time 0.2

read(ADInput)

time 0.5

goto (0)

The two streams are not synchronised.

How can I synchronis the two streams?

Best Regards

Andrew

Share this post


Link to post
Share on other sites

There is not going to be a way to get the read and the output to happen at the exact same time, but we should be able to get very close. First off, delete your sequence that includes the read (ADInput) commands as you don't need it.

Next, in the Workspace click on your DAOutput channel. Select the Event Tab and paste the following code into the Event page.

if (DAOutput[0] != DAOutput[1])

read (ADInput)

endif

Note that if DAOutput does not have any history, the first time it runs through the above code it will return an alert because DAOutput[1] does not exist yet. To avoid this you could initialize DAOutput to zero before you start the timed sequence. Actually, this should be done anyway or the first time you set DAOutput = 1, DAQFactory does not recognize that it has changed from anything so it will not make a read of ADInput. But if it changes from 0 to 1 then your read will happen.

Your other option is to upgrade to a higher version of DAQFactory that does not have the sequence code limitations. The following link will give you more information about higher version.

http://www.azeotech.com/dffeaturegrid.php

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this