09-10-2008 03:59 AM
I've got a temperature chamber and I've got VIs from the manufacturer but they're very basic and I've reworked them to look mor like a standard driver (with VISA references in/out and error cluster in/out). Error clusters/VISA in/out allow me to define sequences now very easily, but I want to write a VI that will change the temperature of the chamber at a variable rate. This implies having a for loop and writing a new temperature value to the chamber periodically until the desired temperature is reached.
I can forsee two modes of operation. Adjust temperature and wait until temperature is reached; or adjust temperature in the background. The first is easy. In the background is much more difficult. While it's easy to branch off and not use the error cluster so it runs in the background, how might I abort the VI? I could use notifiers, etc. but I've only seen global namespaces. And I don't understand how clusters work when passing from one VI to another.
e.g.
- open.vi has an input which is the VISA name. The output is a cluster with a VISA reference and a numeric to simply the protocol over the serial port.
- close.vi takes the VISA reference and closes it
- settemp.vi is the VI I want to write, it would take the cluster from open.vi, error in, desired temp and rate. I am deciding if it's good practice to have a boolean input that if true, the changes in temp would be in the background.
The problems I envisage, is if I were to use close.vi and settemp.vi in the for loop isn't yet finished, there'll be an error in settemp.vi as the visa reference is closed. If I were to use a notifier, how do I give the notifier a dynamic name so that if I have multiple temperature chambers it stops the correct one? Or I could use the cluster and have a boolean that if true, it should stop, but are clusters passed as reference, so if close.vi changes the boolean in the cluster it gets, that stop.vi will see this change and stop?
Thanks,
Jason.
09-10-2008 04:33 AM
09-17-2008 10:55 AM
Hi,
you can use the producer consumer pattern to process some task in the backgound.
Try this example.
Marco Brauner NIG