LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Handling DAQmx Sampling Rate within Event Structure

Hello all,
I've been programming in Labview for a while now, but have recently been introduced to Event Structures. They are useful, however I think in the program below, the event structure is causing me trouble.

VI (Written in Labview 8.0): http://myweb.dal.ca/~jwoodacr/Pendulum.vi

The program itself is fairly straightforward, and by no means complete. One event allows the user to acquire data in real-time (Preview Data Event), and uses the Wait VI to control speed (I know this is not particularly accurate, but the preview does not have to be). The other event is meant to collect data with a well defined time interval between data points.

The problem is, I can press the "Collect" button once, and the "Collect" event will run fine with the values of "Time to Collect" and "Data points / sec" that were input by the user prior to pressing Collect. But, if one wishes to press collect again, no matter how you change the "Time to Collect" and "Data point / sec" controls, the express VI "DAQ Assistant 2" will only remember the very first values you gave it, and will output data with these parameters. So, if you change "Time to collect" to from one (1) to two (2) seconds after having run it initially with one (1) second, it will continue to remember the one (1), and collect data for only one second.

I've attempted to replace the express VI with all the proper DAQmx VI's used to collect in an identical fashion, but those also do not update past the initial conditions that are set. If you enable "Highlight Execution" and watch as the task proceeds, the numbers that are sent to the "DAQ Assistant2" VI are all as they should be, based on everything input on the front panel. It simply seems to ignore them upon execution.

This seems an odd problem, but I am hoping someone may be able to shed some light on it, or has experienced something similar in the past.
Thanks in advance.

Cheers,
Jeff
0 Kudos
Message 1 of 4
(2,739 Views)
The DAQ Assistant only initializes the first time it is called.  Thus each subsequent call, it does not care about the inputs into it.  Another option is use DAQmx VIs and use a property node to modify whichever propreties you want.  You must stop the task before changing its properties.
0 Kudos
Message 2 of 4
(2,720 Views)
Thank you.
I've switched over to using DAQmx VI's for everything and it seems to be working wonderfully. I didn't see anywhere that the Express VI only initializes once and then ignores any inputs afterwards.

Once you build the express VI it has inputs for the 'rate' and 'number of data points,' which to me suggest that one can change these for subsequent runs. It is a bit misleading.

But again, thank you.
Cheers!
0 Kudos
Message 3 of 4
(2,711 Views)
If you open the block diagram, you will see there is a case statement with "First Call?" wired in to determine if the the VIs should be configured.
0 Kudos
Message 4 of 4
(2,696 Views)