06-26-2007 06:20 PM
06-27-2007 11:16 AM
Hi Nishad,
The FGEN will only run when the session is open because this is the reference to the hardware. The software does not know what instrument to control without having the Instrument Handle. As further information, the 5422 actually sets the output to 0V when the task is stopped.
06-27-2007 12:55 PM
06-28-2007 03:23 PM
Nishad,
It is good programming practice to always open, generate, and close your FGEN instrument session. If you want to do continuous generation, you can put the setup and close outside the while loop and generation inside. All of this will lead to you not having to worry about leaving sessions open.
If you want to measure voltage while having the FGEN running, all of this code either needs to go in a sub-VI or the main VI. The code, as you are seeing, cannot be run at two separate times. If you do not want your main VI to be overwhelmed with code, I would put all of this in a sub-vi, and simply return the voltage reading from the sub-vi to the main vi.
06-28-2007 04:35 PM
07-02-2007 07:50 AM
Nishad,
We do not have a way to poll for open sessions, therefore the best advice I can give you is to make sure and close each session after you are done. From your description, having your code in a sub-vi makes for a great implementation of this as you can open the session, perform generation, and then close the session before you exit the sub-vi. This should take care of the ‘just in case’ and give you confidence that all sessions which have been opened, have also been properly closed. Lastly, we will not spec the limit for number of open sessions, so I cannot directly answer your last question, but again believe the sub-vi architecture will eliminate this problem.
07-02-2007 10:47 AM