09-16-2008 11:32 AM
Why/How would an event structure be better than a WHILE loop? Every example I've ever seen for DAQ read/write problems has used a WHILE loop. Could you should me what you're suggesting?
I put all the DAQ stuff under one loop and it seems to be working fine. I've included a screenshot of everthing.
Thanks,
-- Michael
09-16-2008 01:43 PM
Michael,
Is there a reason you haven't started the AO and AI task outside of the loop? Placing a DAQmx Start VI before the loop will increase the VIs performance, since you let DAQmx know you plan on doing more than one write and read. You can use an event structure to only write or read when you change a value. There are several examples of event structures in the LabVIEW help. One useful example is called Draw Graph with Events.vi. Rather than constantly polling for your mouse position it uses events to only iterate and monitor the mouse position when the mouse button is pressed.
Regards,
Neil S.
Multifunction DAQ
Product Support Engineer
National Instruments
09-16-2008 02:51 PM
Neil S. wrote:Michael,
Is there a reason you haven't started the AO and AI task outside of the loop? Placing a DAQmx Start VI before the loop will increase the VIs performance, since you let DAQmx know you plan on doing more than one write and read. You can use an event structure to only write or read when you change a value. There are several examples of event structures in the LabVIEW help. One useful example is called Draw Graph with Events.vi. Rather than constantly polling for your mouse position it uses events to only iterate and monitor the mouse position when the mouse button is pressed.
Regards,
Neil S.
Multifunction DAQ
Product Support Engineer
National Instruments
Hey Neil,
Thanks for the assistance. One of the things I should mention is that, in the future, there won't be any user controls (i.e. the sliders will go away). What's going to happen is that a file will be read and values from that file (about 8 of them) will be fed to the analog outputs (out of LabVIEW) that are sent to an external computer. That being said, will I still need the event structure that you're talking about? I'll take a look at the VI you mentioned as well.
As for the Start/Stop Task VI's, I thought they were only needed for digital signals (silly me). I'll add those as well.
Thanks again,
-- Michael
09-17-2008 12:50 PM
Hello Michael,
Thanks for your post back!
I believe Neil was mentioning the event structure for the user interaction. If you program will not have file witting user interaction then you may not need the event structure. It will depend on your program and how it is written. When you have a chance definitely take a look at the programs Niel pointed you to and let us know if you have any other question/concerns.
Cheers!
Corby_B
http://www.ni.com/support
09-17-2008 12:55 PM
Michael,
If the AO values are continuously updated than using an event structure is probably not needed. An event structure makes more sense in a UI case where you don't know how often the event will occur. In the case of a UI you don't know, for example, if the user will walk away for 2 hours. You don't want to be continuously updating the AO during this whole time. If you are reading values from a file there are a number of other structures that could be more appropriate. In the simplest case you could simply read values from the file in the same loop that you write them. In a more complicated case you can queues or notifiers. The biggest point I think we are trying to make, is that ideal your AO loop will not iterate if it doesn't have something to do, it only iterates when it actually needs to.
Regards,
Neil S.
09-17-2008 06:42 PM
Corby, Thanks! Neil, Thanks!!
And, I think I'll do just that (i.e. put the file reading stuff in the same big loop). I'm assuming that big loop is okay since no one said otherwise 🙂 I realize that there is actually very little user-interaction. We want to start the system and let it do its tasks: system reset, file read for signal values, passing the values to the external computer, and record any alarms (digital signals) coming from the external computer. We need to do some datalogging as well, but I'm not sure how that's going to happen just yet (more of a external computer issue than LV).
OHHHHHHHHHHHH, somebody can answer this question for me. I see that LV does datalogging but the logs seem to be in some other format. Can the datalogs be in plain text format?
Thanks guys,
-- Michael
09-18-2008 10:32 AM
Hello Michael,
Thanks for your post back!
You are right and there are alot of options to data log in LabVIEW. By a text format do you mean in a string format. There are some VI's that you can use on the File I/O functions palette that will allow you to save information in many different ways. There is write to spreadsheet, to text file, to binary file and other VI's that you can use. The write to spreadsheet has a format input so you can change the way it is written to file. There are also many conversions that you can do as well to get the data in the format you want. If you have very specific questions about LabVIEW functions those questions might be better suited for the LabVIEW forums. Have a great day Michael!
Cheers!
Corby_B
http://www.ni.com/support