LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State machine for text-based instrument control

Hello,

 

I am trying to control a text-based instrument to set various parameters and turn modes on and off.

 

My main question is about the four case structures on the far right of controller.vi.  I need something that will write the command to visa (just once) after a button click.  The way I've done it is obviously not ideal.. I'd like to be able to have a boolean (or preferably a radio control) controlling RC mode on/off and common mode on/off.  As far as I can tell, the way that sort of thing is *supposed* to be done is with an event structure, but I've only got the base package.  Radiobuttonstatemachine.vi is my first attempt at trying to make a state machine for this purpose.  But it just runs once and then quits, or while it's running it hangs everything else up.  

 

Currently the VI only works in continous mode-- I'm pretty sure that's one of my biggest problems-- no? What is the correct way to make an event structure without an event structure?

 

Best regards,

Anna

 

PS.  Apologies in advance-- I know this is probably really obvious but all of the questions and tutorials I can find do this kind of thing with an event structure, which I can't use. I'm an undergraduate doing an internship and this is my first time using labview (basically my first time with any programming) so ANY ANY help would be be very appreciated.. Also any comments on my coding since I don't know anyone that's good at labview and can point out improvements to me. THANKS AGAIN.

Download All
0 Kudos
Message 1 of 3
(2,671 Views)

There are a few things to remember with LabVIEW. The reason your program only works in continous mode is that LabVIEW is a dataflow language, it executes the objects as their inputs are satisfied, then their results travel to the next "node". In your original program the messages to the instrument are in "nodes" that are all "serially" connected, so that unless you run it in continuous mode there is no loop back to the beginning to read any changes. When you start the program in the non-continuous mode it will read all the front panel settings almost instantly, "flow" to the message sending nodes and then end.

 

Can you get the full package? User interfaces are much easier to design with "events", but remember thoise were only added a few major releases ago, you just have to be trickier.

 

Here is a quick modification to your radio buttons.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 2 of 3
(2,656 Views)

Thanks for your help,  LV_Pro! Unfortunately, I don't think I can get the full package, unless my boss gets very generous.. 

 

For my program, then, would you suggest an alternative to "serially" connecting nodes- maybe I try breaking up tasks into parallel-running state machines? My first effort was to do things 

linearly  because there's only one hardware controller I'm talking to, wouldn't having different things running mess up the VISA operations?  If "events" were only added a few major releases ago, do you know if there is there somewhere I can find the example vi's from previous releases?

 

Thanks again for your help.

Anna

0 Kudos
Message 3 of 3
(2,622 Views)