11-23-2010 08:33 PM - edited 11-23-2010 08:34 PM
Good evening everyone, I have been lurking and reading a lot, but this is my first post! I need a little help with labview in the area of continuous serial read/write and how that works with a produce consumer type loop.
Basically I have a Marposs DigiCrown LVDT unit that I can query to get its current position using the manufacture’s driver the VISA Vis. These units lack a streaming where I can issue only one command to start, and one to stop. Instead I have to issue the instantaneous reading and then read the results.
In the end this VI will work with the fixture and will have about 4 total LVDTs on it. Only 1 LVDT will be used at any one time.
So basically from my reading on the forums, one of the better ways to handle GUI events is by using the producer consumer type design. This is especially true if there are many buttons on the GUI. My attempt at this has failed, probably because I used another while loop inside the consumer while loop (a no no I believe). The continuous measurement works great, but getting it to stop the measurement does not work because the case never completes.
So in a nutshell, I need help using the producer consumer design (or another one if this is not ideal) to start and stop a continuous read/write loop to a VISA serial port. I attached a screenshot of my futile attempt. Any feedback would be great! I would like to know if there is a way to avoid the loop within the loop, and if there is a better way of stopping the inner "measure" loop than using a stop button inside it (maybe using the produce event case?). I am very new to Labview, and am probably in over my head, but that is okay for the time being, so any feedback is extremely welcome.
Thanks!
11-23-2010 09:57 PM
I don't understand your design. The producer loop generally generates the data p hence the term producer. Perhaps you should look at the
producer/Consumer Design Pattern (Data) or put your acquisition in the timeout event.
11-23-2010 10:26 PM
I don't exactly find that surprising, this is my first run with produce consumer design.
Basically, in my searching of the forums I have seen where some people have suggested to use the producer loop as a way to control the consumer loop. In other words, the buttons used by the user on the front panel are housed in the producer loop. This loop monitors for an event change and sends the event to the consumer loop.
The consumer loop is now aware of what button was pressed on the front panel and now can take the appropriate action. It is my understanding that by using two loops it provides a smoother, more responsive front panel that is more scalable. I attempted at doing this inside one main loop, however due to the nature of the event structures, the front panel would lock during the "continuous measurement" (as it should). In order to allow the event structure, and then the while loop to finish, you had to click the stop buttons in precise order.
Also, I just noticed I posted the screenshot with the random number generator, not the VISA commands. Ill repost it in just a few minutes.
11-23-2010 10:39 PM
Alright here is the correct one without the simulated data. The first VI outside the loops is the VISA serial configuration. The second VI inside the while loop is the VISA write and VISA read commands.