09-13-2010 12:25 PM
Hello,
(1) If I have a global virtual channel (AI) created in MAX program, and I just want to read a value from it in Labview, do I need to use the Start Task and Stop Task functions? What if just using the Read function without Start Task and Stop Task?
(2) My understanding is that if a virtual channel is called in Labview (for example in Read function), a task is created automatically. This task is local, not global. Is this understanding correct? If so, it sounds creating tasks in MAX is more straightforward than global virtual channels. What is the use of virtual channel?
(3) The help menu says that the local virtual channel created in Labview will be eliminated when the task is completed. I do not understand it. What if the Labview program is aborted? Would you please correct my understanding?
Thank you very much!
09-14-2010 11:21 AM
Hi playsport-
1) You do not need to call Start/Stop. In fact, just drag your global virtual channel from MAX onto your block diagram, right-click the output and select Generate Code»Configuration and Example. LabVIEW will automatically create code that allows you to read your channel.
2) A virual channel called in LabVIEW does create a local task. A virtual channel becomes a task once timing and triggering is added. The virtual channel only takes a physical channel and adds things like max/min limits, measurement type, custom scaling, or a name. It is possible that you set up this global virtual channel and multiple programs use this channel with different timing engines, different timing rates, different triggering types, etc. The virtual channel just gives you a little more flexibility than an entire task does, since the task defines everything needed for a program to run. The virtual channel allows to to adjust the timing and triggering.
3) The local virtual channel just means that that channel is being reserved for a specific task by clicking the Run button. Whether the task 'completes' or is aborted, that virtual channel is eliminated when the physical channel is no longer in use, meaning that another task can use that virtual channel once the original task is completed or aborted.
I hope this all makes sense. Best of luck with your application!
09-15-2010 01:18 AM
Hi Gary,
Thank you very much for your answers! They are really helpful. If you do not mind, I would like to ask two more questions.
(1) If we keep updating a physical channel, for example using Write funciton to send command "output 5 V" to channel AO1 at 10 Hz, does the repeated commands "physically" update the channel 10 times per second or actually nothing happens at the hardware level (the channel just stays at 5 V without any disturbance)? This question is to understand whether repeated commands harm the National Instruments cards or not.
(2) To write to a task using Write function, we need to start the task and stop it. Personally I like to start a task at the starting point of a program and stop it when the program ends. Or you may start and stop the task every time when you write to it. Which way is better?
Thank you very much!
09-15-2010 05:30 PM
Playsport-
(1) The command does physically update the channel 10 times per second, but all you will see on the output is a constant 5 V (with almost all cards - some AO cards will glitch at each call). No, this will not hurt the NI card in any way.
(2) It is better to start the task once and close it once at the end of the program - do not start and stop every time you write to it.
I hope this helps. Have a great day!
09-16-2010 07:14 PM
Your answers are excellent, Gary. Thank you!