04-15-2007 06:11 PM
04-15-2007 09:58 PM
04-15-2007 10:43 PM - edited 04-15-2007 10:43 PM
Message Edited by bmunden on 04-15-2007 10:56 PM
04-16-2007 09:45 AM
04-16-2007 09:59 AM
04-16-2007 10:09 AM
bmunden wrote:
Waaaait, wait, wait. So data tunnels aren't real time? Good to know. If I have a bunch of DAQ going on in a while loop, it only comes out when that while loop is stopped?
Correct. Think of it this way. If you had a loop doing repeated operations on a set of data, you wouldn't want that data leaking out of the loop until you told the loop to stop, otherwise your data may be incomplete or inaccurate.
I want gages on the front end to show real-time, so I thought using "continous" task generation from DAQ Assistant was the way to go.I won't claim to be an expert on Express VI's. Continuous is basically telling it DAQ to acquire continuously an indefinite number of samples until some particular condition as been met. The other options would be acquire 1 sample, or acquire N samples.
I also want, when I push a button, this to happen:
1) Digital line outputs.
2) Record the continuous signals that go to the front end gages.
Thoughts?Message Edited by bmunden on 04-15-2007 10:56 PM
I made some modifications to your VI. I can't test them as I don't have your DAQ hardware, but I think it will work.
1. I set up the DAQ Assistant to acquire 1000 samples. With your 1 kHz rate, it should acquire a 1 second batch of data then pass it on to the other nodes in the loop. Thus your screen should update about once per second. If you want faster, set it up for 500 samples for twice per second, or 250 for 4 times per second. Any faster than would probably be faster than you could possibly and would just waste processor cycles on the screen refresh.
2. I set up the stop button to that it would have a switch rather than latch action, this allows it to have a local variable so that it can stop the data acquisition loop as well when you are ready to end the program. I added a flat sequence frame around both loops, and a frame after that writes a false to the stop button. This way it will appear to act as a latch mode and reset the stop button to false once the program knows that both loops have been stopped by reading the stop variable.
3. I put in a Wait Until Next ms function with a value of 10 in each loop. You can play with this value if necessary. But it is always a good idea with loops to put in a small wait so that it yields some time to the processor to do some other tasks. Otherwise the loops will run as fast as they possibly can and will make the program appear to respond sluggishly.
4. I put the write to file express VI inside your DAQ loop inside a case statement. This will execute whenever the Write to File control is toggled to true.
With all of this, your VI should be able to acquire a batch of data, process it, and write it to the file. The loops will repeat processing more data until the user hits the stop button. There may be room for adjustments in the number of samples acquired at a time, how fast the digital output loop should run, how many DAQ samples you want to acquire in one shot.