Nested State machine - Loops continuous​ly

Hello ,
I implemented a program for first time using state machines and Enum (type def). 
I have 2 state machines (nested) 
I am not sure if the data flow between the Main state machine and the Sub state machine is correct. The program loops continuously ( this is a MOTOR PROGRAM) and I see that the motor keeps working continuously. It is supposed to run the mentioned Number of Steps once and then stop.
Please have a look at my code and tell me where I could have gone wrong. 
Thank you.
Abhilash S Nair
Research Assistant @ Photonic Devices and Systems lab
[ LabView professional Development System - Version 11.0 - 32-bit ]
LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021
OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]
Attachments:
Motor-UNI_Directiona Dev 1.vi ‏49 KB
Control 1.ctl ‏6 KB
Control 2.ctl ‏6 KB

Figured out ! Thank you. One of the ENUM was not defined to the correct state.
Thank you. 
Abhilash S Nair
Research Assistant @ Photonic Devices and Systems lab
[ LabView professional Development System - Version 11.0 - 32-bit ]
LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021
OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]

Similar Messages

  • Problems closing several loops in a state machine with an event structure

    I am having some problems closing three loops running in parallel in a state machine.  I have one loop for an event structure to monitor user controls to change the state.  The other loop is the state machine which will control an actuator, and the third loop is for data aquisition/analysis.  I want to be able to hit the stop button and go to a "shutdown" state where I can home the actuator then close the loops and finally go to the last "shutdown" subdiagriam in the flat sequence structure.  Currently when hitting the stop button it goes into the shutdown state and will end the state machine loop but it appears the other loops are not closing until I hit the stop button again.  Could this be due to using a local variable for the boolean to control the loop conditions? I attached a screenshot of the block diagram.  Any advice would be great!
    Attachments:
    example.png ‏108 KB

    You have a classic race condition due to overuse of local variables. If the stop event fires in the upper loop, the local variable connected to the loop termination condition has already been read (it is false!). This means that the upper loop will iterate once more and again wait at the event structure for the next event. At this time, the local variable connected to the loop termination is TRUE, but the loop cannot complete until the event fires again, for example if you press the stop button once more.
    The correct way is to connect the terminal of the stop button across the right event frame directly to the loop termination terminal. Now it will get the TRUE value correctly once the stop event fires for the first time.
    LabVIEW does not execute left to right, execution order is determined by the wiring.
    I also agree with the above message that you should rethink and re-architect your code using established coding guidelines. 
    LabVIEW Champion . Do more with less code and in less time .

  • Producer consumer vs state machine

    Hi there,
    I have been on and around for quite a while to understand how can I re-design an application, which was originally built using a mix of sequence structure, while loops and event structures. And now I am making a newer version of the same application, for research purposes, while learning the LabVIEW techniques. Earlier I used LabVIEW versions 5 and 6 to make simple programs for fuzzy logic and neural networks. And that's not a good reference.
    Ok, after learning that Producer Consumer (PC) and Standard State Machines (SSM or SM) are two new approaches for a better (scalable, flexible and efficient) coding as suggest by veterans, in one thread where I asked about another issue, I have started digging into this topic and now I am on a point where I have to implement it finally (spent pretty much time in the learning phase).
    I have several questions.
    To start the discussion, I would give a brief description of my application.
    It's a networked application, where the network communication happens using DataSocket (one reason to use LabVIEW as the environment).
    We are talking about the client application, which communicates with other applications on remote computer, via Internet.
    User interface involves a tab control, with several pages-
    On startup, the controls/indicators (now onwards referred as controls only), are initialized, datasocket connection is checked (rather internet is checked, and a connection established with the remote datasocket server) (page 1)
    If connected to the datasocket server, the user selects Login/Registration (page 2)
    Login and/or Registration happen on page 3/4
    Then the user sees a table of remote users to connect to (page 5)
    Upon selection of a remote user, and after clicking on "connect", the user will see a video indicator, with a lot of other controls. (page 6)
    On this page with video indicator and controls, the user has a lot of activities, in which many messages are sent and received to/from the remote machine.
    the user may disconnect and go back to page 5, and log out and go back to page 2 and so on.
    I hope this is clear.
    I have thought about two different ways to do this application. Using PS or by SSM.
    In the attachments, I have given a diagram (with errors, of course, because of unlinked controls), for each of the approach, plus the original application's diagram.
    I hope this is sufficient for anybody to understand my case and give suggestions.
    I am looking for suggestions about which is a better model for my type of case. I have been to discussions like this one and saw that there are many issues regarding dequeue in PC model. So I am curious to know if SSM is a better and latest model or it's more primitive? Which looks better for my application's performance?
    Thanks ahead!
    Vaibhav
    Attachments:
    OldDesign.vi ‏41 KB
    PCDesign.vi ‏42 KB
    SSMDesign.vi ‏46 KB

    Vaibhav wrote:
    @ Harold
    Thanks. Any suggestion how can I start and stop that loop in parallel with other loops? Like, if some event occurs, the loop should start execution, and keep on moving, while other events are being traced and executed.
    In those examples where you had a while loop inside a case structure, that bit of code will only execute one time.  It will immediately read the boolean at the start of the program, if the value was true before the porgram started, then the while loop will run.  Once that while loop stops, the case structure will end.  It will never execute again unless you completely stop and restart your program.  If the boolean is false before the program starts, the false case will execute immediately.  Nothing happens since it is empty and it is done, never to run again (unless you stop and restart your VI)  You should turn the structure around.  Put the case structure in the while loop.  Make sure you put a small wait statement in the loop so that it doesn't run full speed eating up CPU cycles just polling the status of the boolean.
    @ Ravens
    Thanks for the detailed comment.
    One thing I would clarify. The user will not be able to switch between the pages using the tab control. The program will direct appropriate page to the user. I kept the tabs visible just for your idea of the pages. Sorry, I didn't mention that.
    Do you think it's still a bad design?
    If the tabs will be hidden or disabled, you will probably be okay.  I wouldn't call it a bad design.  I wouldn't do it that way.  But as long as you understand the possibility of problems and prevent that.  Especially some time down the road when you modify the program in some other way that could lead to a problem because you forgot about the dependencies of the event structures on the state of the state machine. 
    Yes, I agree about only one event structure to handle all the events. But since the user will not be able to click somewhere else, other than those possible controls, I thought to keep it like this.
    I thought the events are captured only if we are in that case. I think I am wrong, right? Events are captured at any time, even if the case has never executed before, or will never execute.  Ok, The events will be captured, but will not be executed until in that case.
    And that's the reason why I have two separate event structures, in two separate phases of the program.
    Because, prior to page 6, the events will occur sequencially. The user will click somewhere, then some message will be transmitted over DataSocket, then some message may come , then again some user action and so on. But, when the user starts using page 6, there will be parallel process of user controls events and actions, and incoming messages and corresponding actions. For this, in the page 6, I need a different kind of execution. So I separated the two event structures.
    At first I thought to have SSM, and then I thought to PC, just because I can have two separate parallel processes - one for user events, and another for messages (because that way I can take maximum advantage of message tracking). But looking at other complexities, I find SSM more appropriate. Can you please tell me how can I have my message loop and events loop parallel to each other and just one event structure?
    You can have a dequeue function in your state machine loop and have it be a consumer loop.  Use a timeout on the Dequeue.  If there is a timeout, have the statemachine execute normally after that perhaps just passing the enum wire straight into the case structure of the state machine.  If it doesn't timeout meaning you got a message, then look at the message that is dequeued and act on it.  Perhaps it means ignoring the enum coming in from the shift register and changing the enum to something else to feed into the case structure of the state machine.  Attached is an example
    Attachments:
    PCDesign[1]_BD.png ‏6 KB

  • How to run a particular case continuously in event based state machine architecture.

    I am making a program using event based state machine architecture, it is running as expected whenever i am generating an event, case structure corresponding to that event executes.
    we are taking some measurements from oscilloscope e.g. i am having one boolean button for rise time whenever i am pressing that that button it displays the value of rise time, it displays only once( since i have generated an event on that boolean button so it executes only once and displays value for one time and then comeback to timeout state) but in our program what we want, we want it to update value continously once that button is pressed.
    Now for a time being i have placed while loop on the case corresponding to rise time but this is not the right approach.
    since i am using state machine architecture( event based ), i am not getting how to run particular case continuously ,or if there is any other better architecture that i can use to implement the same application.
    Attached below is the program.
    Attachments:
    OScilloscope .zip ‏108 KB

    Say, in the attached program, when the user selects Autoset, it inserts corresponding state (Autoset) and now if you want this state to run again and again, probbbly you can again insert Autoset state while executing Autoset state... ohhh its confusing... check the picture below (A picture is worth a thousand words):
    1. Based on user selection, insert Autoset state.
    2. Re-insert Autoset state again and again while executing Autoset state.
    3. Now to come out of this loop, based on appropriate event generation, insert any other state AT FRONT (equivalent to Enqueue Element At Opposite End).
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Run Code Continuously in Event Driven State Machine

    Hi there, I was wondering what is the best way to run code continuously in an event driven state machine. Particularly, I am going off the JKI state machine. At the moment I put the code I want to run continuously (acquire from an instrument) in the timeout case of the event structure. When the user presses the button, the event sends the value 0 to the timeout terminal of the event structure (through a shift register). If the user stops the acquisition then the value -1 is sent to the timeout terminal. This is a tip that I took from an article by Mike Porter.
    Would it be better to run this process in a separate loop? Is a state machine a bad design choice for running code continuously? I don't like my current solution because if I have another process I'll have to start putting case structures into the timeout case. Also, if the process takes a while then the event structure will take a while to respond.
    Thanks for your input!

    AKA_TG wrote:
     Adding to that I believe Preview Queue element to read the data and Lossy  enqueue to transfer the I/O output, especially if the I/O device responds slowly. This should keep your event structure polling along very nicely during I/O calls to the other structure.
    I actually prefer to use an User Event to send the data to the main event structure and/or whoever else needs it.  I am not a fan of the lossy enqueue (loss of data).  At that point, I might as well just use a Notifier and/or global variable.

  • Shutting down a queued event state machine with multiple parallel loops

    I am trying to find the best way to shutdown a program that consists of a queued event state machine architecture with multiple parallel loops. Can anyone recommend the best way to accomplish this in my attached VI? (From browsing the forum, this seems to be a common question but I haven't found a solution that works for me.)
    I welcome any other feedback on my code as well, if anyone is willing to offer it.
    My Program Requirements:
    If the user presses the "Shutdown" button, the program should prompt the user with "Are you sure you want to stop the program?" and then either return to the Idle state or proceed to stop the program. Additionally if there is an error, the program should prompt the user with "Clear error and continue, or Stop program?" Then either return to the Idle State or proceed to stop the program.
    Details of architecture:
    The program consists of 3 parallel loops: (1) an Event Handling loop that enqueues various States to a State Queue, (2) a State Machine which enters the latest state that is dequeued from the State Queue, and (3) an Error/Shutdown handling loop which processes any errors in the Error queue.
    During normal Shutdown, in the Event Handling loop the "Program.Shutdown" event case executes, and the States "Shutdown" and "Idle" are added to the State Queue. In the State Machine, the "Shutdown" state is invoked. A special error code "5000" is added to the Error Queue. In the Error/Shutdown handling loop, the "5000" error triggers a prompt that asks the user if they want to stop the program. If the user chooses not to stop, a notifier StopNotif is sent to the "Shutdown" state and "Program.Shutdown" event case with the notification "Go". If the user chooses to stop, the notifier sends the notification "Stop". The Event handling loop and State Machine are terminated if they receive the notification "Stop".
    In case of error, the program behaves similarly: if the user chooses to clear the error and continue, the program returns to the "Idle" state.
    HOWEVER - if the user chooses to stop the program, the program stalls. The notifier that is sent to stop the Event Handling Loop and State Machine cannot be read because the Program.Shutdown event case and the Shutdown state (which contain the "Wait for Notifier" function) are not active.
    I have been able to activate the Shutdown state by enqueuing it in the Error/Shutdown handling loop. But I don't know how to activate the "Program.Shutdown" event programmatically, and thereby access the "Wait for Notifier" function inside it.
    I tried to place the "Wait for Notifier" function outside the event structure, but then the Event Handling loop never completes. Placing timeouts on the "Wait for Notifier" and on the Event structure makes the program work, but I want to avoid using timeouts because I don't want to turn my event-driven program into a polling-based program. I'd also like to avoid using variables or property nodes to stop the loops, because that requires creating a control/indicator for something that the user doesnt need to interact with.
    Thank you!
    Solved!
    Go to Solution.
    Attachments:
    Queued event state machine parallel loops empty.vi ‏46 KB

    Thanks for clarifying that, Ravens Fan.
    I marked crossrulz as the solution for pointing out User Events to me.
    I also adopted Ravens Fan's suggestion to keep the Shutdown procedure out of the Error Handling Loop. This has simplified the architecture by eliminating the need for Notifiers. Instead, I have used booleans in case structures to stop the Event Loop and State Machine, and Release Queue to stop the Error Handling Loop.
    For reference, I'm attaching my corrected code.
    Thank you to everyone who helped!
    Attachments:
    Queued event state machine parallel loops empty in progress.vi ‏44 KB

  • Allow state machine while loop to end only in 1 of the states?

    What is the best way to ensure that the while loop that surronds state machine case structure only ends in a certain one of the states?

    I have solved the problem of having the VI not stopping (apparently it was due to an event structure). However, now I have another slight problem. I need the state machine to terminate on either of two conditions:
    1) If a stop button is pressed
    OR
    2) if the end of the sequence is reached.
    As I have implemented it so far the VI terminates because of the second condition and does not allow me to terminate it by pressing a 'Stop' boolean button. I know that this might be a bit fundamental and simple but I'm new with state machines on labview.
    Thanks.
    Attachments:
    State machine.vi ‏21 KB

  • Producer Consumer with a state machine within the consumer

        Hi All,
    I have been trying to develop a data acquisition system with the producer consumer architecture.  To the left of the two main loops I initialize the serial port and any constants and variables im using.  I also have an obtain queue VI needed for enqueue and dequeue. Then in the producer loop i have a state machine.  The first state is where I wait for a button press on the front panel to write a GO signal on the serial line which will tell the device connected to the serial port to begin sampling data.  After this button press I go into the next state which is called my read state.
    In the read state I use a property node to read all of the available bytes at the serial port and then enqueue this collected data into a queue.  The state machine then is directed to continously go to the read state again and collect more data.
    Now this is where my dilemma is......  The consumer loop has the dequeue VI inside it and after this VI i have a state machine (while loop and case structure) which contains the following states
    1.  Build Array - build an array from the dequeue element and if there is any left over data from the parsing states it will build an array with the left over data and the dequeued data
    2.  Determine packet type - this state looks for the packet type byte(not necessarily the first byte in the message) and also check the next byte (packet length) to ensure that I am at the begininng of this chunk of data.  This state may be a little slow because there can be three different packet types and based on this byte and the packet length it may have to search the array several time to find the valid starting point.  This state also determine the next state to go to based on the packet type.
    3 packet type 1 parsing - parse data and store the remaining data it leftOver array.  Go to exit state.
    4 packet type 2 parsing - "" ""
    5 packet type 3 parsing - "" ""
    6 exit - leave this state machine and fall back to the consumer while loop.
    After it exit I think it should fall back to the consumer while loop and dequeue more data and enter the state machine again to build a new array with the dequeued data and leftover data.  It seems to work when I trace the execution using the Highlight execution feature, however when I run this all at full speed, it seems to go into the consumers 1st and 2nd states back and forth and not completely go through the state machine.
    I tried adding in a delay in the producer loop to give the consumer loop time, but I didnt notice any difference.  Is it possible that my dequeue element is retreiving more data while im still in the state machine, causing the execution to leave the state machine before it finished all states?
    Is there a better approach to take to solve this problem. Basically I need to read data at a 1,000,000 baudrate and parse it as quickly as possible so that I can break it up into 3 different packet types, write the data to a file, and graph the actual data (header info removed) in realtime.  I need to also ensure that I am not losing any of the collected data.  Data loss cannnot occur.

    A couple of things more to go along with Ben's pointers:
    You convert your data from a string, to a U8 array, to a Hex string array in the producer loop, then convert back to a integer to determine what to do with it.  In the process, you create two or three copies of your data, slowing yourself down quite a bit.  The code would be quite a bit more efficient if you left the data as a U8 array.  You can change the format of the controls and indicators to show hex values instead of integer by right clicking on them and selecting Format and Precision...
    Your search code is fairly inefficient.  I made a whack at making it a bit better.  See attachment below.
    If you continue to run into race conditions, you can debug them using a calls to the Windows debug write sprinkled liberally about your code.  Check out the post here for more information.
    Don't let your lack of format LabVIEW training stop you.  The biggest thing to get is the data flow paradigm (aka data is wires, not registers).  Once you get past that and learn how to pass data around using shift registers, queues, events, etc, you are most of the way to mastering LabVIEW.  The rest is just learning the plethora of functionality LabVIEW gives you (yes, I have reimplemented LabVIEW native code more than once in the process of learning).
    Let us know if you need more help.
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    serialUtil_V3_DFG.zip ‏137 KB

  • Queues even driven state machine

    Hello,
        i am working on this software and doing it via queues even driven state machine but Im having problem with. I understand how queues and event structure work but here's my problem. when I pass a massage to my state machine from the event structure via Queues. It works fine then stop. My goal is for the second loop where the state machine is to continue working but not wait on the next message. I tried ot use a time out on the queue but that didnt work. Is there anyway i can do that. I attached the VI. it's not finished yet but you will see what Im doing with it
    Attachments:
    check.vi ‏38 KB

    Bob, thanks for your input. I attached the full vi for you to have a better understanding of what Im talking about. Keep in mind though it works it isnt closed to finished.
      My goal is to toggle different boolean that will generating different data. Each Boolean will generate a messgae via event structure to my message handling loop. once the message is passed, that loop will queue in the state of the data to generate. Once dequeued my plotting loop will generate the data then queue it in for display. It seems like there are too many queues being used but that is how I plan to write the VI. I want my 3rd loop to always generate the data so that my fourth one can display but that isnt working for me since the 3rd loop is always waiting on a message from teh 2nd loop ( messge handler). If you foolow the data flow you'll see what I am referring to
    Attachments:
    check2.vi ‏499 KB

  • How do I add new data to the same file in a State Machine?

    Hello,
    I have a State Machine, with a State where 3 samples of data are collected in a For Loop. I would like to save this data in a file and keep adding new data to the same file each time I get to this state. The problem I'm running into is that each time I reach this State, my old data in the Excel file gets replaced with the new data instead of being continuously added in the same file.
    Ive tried Shift Registers but I may not be using them correctly since my file keeps displaying only 3 new data points.
    Any ideas will be appreciated!
    Thank you, so much.
    -Peter

    Where should I place these shift registers? Where should I place my File I/O VIs? Is it possible to use the Write to Spreadsheet File VI in this situation?
    Ive attached a very simple example of the problem. Thank you.
    Attachments:
    StandardStateMachine 2.vi ‏16 KB

  • Terminate state machine

    Attachment is the simple state machine i did and for ur better understanding.
    I have a state machine and which initially is at case "wait". After pressed the start button, it go to case "First" which sum the values and then got to case "Second" which subtract the values. And it will back to the wait again.
    Wait i wish to is
    1) I wish the state machine to stop after the case "Second" or after subtract the 2 values and switch on the LED (2nd Sequence) in the second flat sequence frame.
    2) I only want the loop to run for one time only and do not repeat.
    Thanks for ur help and time or reading.
    Attachments:
    Simple State Machine.vi ‏18 KB

    neiviv wrote:
    Hi Mathan,
    Is it possible to save the VI in labview 8.0 version
    You don't need it. Pnt's solution is better because it does not use local variables.
    neiviv wrote:
    I added a TRUE to stop the loop but it did not stop and continue back.
    Are you using the "continuous run" button to run the VI???   Don't!
    Use the plain Run button!.
    LabVIEW Champion . Do more with less code and in less time .

  • Flexible state machine "configuration" (script interpreter?)

    Hi all,
    I am currently re-thinking the implementation of a larger labview project which controls
    an instrument via RT on a CRIO system.
    Since the instrument is constantly improved and new features added to make it more and more
    automated I come to the limits of the current design.
    A quick description:
    The instrument should be capable of taking different kinds of measurements either at
    constant conditions or at conditions that continuously change.
    Before an measurement, the instruments needs to be conditioned, which is a rather complicated
    sequence of valves opened/closed, pumps started/stopped, temperature settings and so on.
    I currently use commands stored in a text file and read into an array of command clusters (enum'ed command + string for parameters)
    to be processed during conditioning.
    Then the user can run another sequence to make a certain kind of measurement.
    This works nicely but is not flexible enough. The conditioning and measurement sequences should be easily 
    editable without making changes to LV code.
    This is one reason I did not yet code this as a state machine, but it is a logical next step to do so.
    States would be idle, conditioning, measurement, re-conditioning ....
    But how do I do this in a most flexible way?
    In the sequences, I sometimes need to check for instrument parameters, and it would be elegant to
    call sub-sequences. I already implemented a looping feature to repeat some commands
    between two positions in the command array several times. But without the possibility to jump
    out of the loop.
    In short, if I continue this way I am about to write an interpreter for a simple scripting language .....
    I know that possibly VeriStand has a lot of this functionality but I am bit hesitant to make
    a big change like this and I am not sure if I can re-use the existing LV code to access and control
    hardware using VeriStand.
    Is there a good/elegant solution to what I intend to do with just LV and without re-inventing the wheel (script interpreter)?
    Olaf

    The most flexible way to implement this would be to use a command pattern and LabVIEW classes.  Using this approach, you core state machine would probably never change and you dynamically add or remove steps as needed.  Take some time to learn how this works by writing a couple of simple examples, then dive in.  It will be easier than you may think.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Web Services for a State Machine Based VI

    Hello,
    I am new to the Web Services approach but so far I have managed to build a simple VI which is used with Web Services to display a Graph and make some simple calculations.
    However, I have a more complex application which uses a State Machine architecture to command some circuitry using the NI USB 6211 device. This program includes different states and all the action takes place inside a while loop. This loop uses shift registers to pass the states arround (the JKI State Machine).
    My question is: Could such a program be used with the Web Services without modifying this structure?
    In the programs that I have tried, if I place the execution inside a While structure then I get no result with the Web Services. 
    An example of a simple program which includes a while loop and the Web Services approach would be helpful, if possible.
    Thank you in advance.

    Hello again,
    I was trying to do what Nathand indicated.
    1. "Put a functional global in it that stores whatever value you want to be queried over the web,"
    So I opened a new Project and added the Index.vi just to generate the numbers continuously. This VI writes to a global variable entitled "GlobalOutput.vi".
    This works as I have attached the jpg image.
    2. "and make that VI accessible through VI server."
    This I am not so sure I did correctly. I opened the Tools->Options->VI Server, and here at the section Exported VIs, I added the GlobalOutput.vi. I have attached the image.
    3. "Then, in your web services VI, open a VI server connection to that functional global and run it, by reference, to obtain the value stored there."
    Now I have created another VI, called ServerConnection.vi which runs the GlobalOutput.vi. I have attached the image with the error I get. Something is wrong in what I am doing. In the end I thought that I would create a Web Service for this last vi and basically be able to read the global variable.
    As I understand it, you have a VI which runs locally, in a while loop and updates some global variables. Then another vi reads the values of those global variables.
    It is this last vi that you should create a web service and interogate to find out the values of those variables. What am I missing?
    Thank you in advance.
    Attachments:
    GlobalVariable.JPG ‏21 KB
    ViServer.JPG ‏36 KB
    error message.JPG ‏38 KB

  • 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.
    Attachments:
    controller.llb ‏513 KB
    radiobuttonstatemachine.vi ‏14 KB

    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
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion
    Attachments:
    example 9-29-08.vi ‏15 KB

  • Nested FOR cursor LOOPs, BASIC QUESTION

    Hello,
    I am trying to nest a For-loop using a cursor (see below), but the program is not entering the second (nested) for-loop. This program compiles fine, but during run-time, the nested loop does not execute. I'd rather not use FETCH statements and keep everything in place. I think the solution is rather trivial, but I'm new to PL/SQL. PLEASE HELP!!!!!
    cursor c1 is
    select coi_con_uid,coi_not_code,coi_closed_yn,coi_timestamp
    from s_coi_con_issue
    where coi_not_code = 'NOT107'
    and coi_timestamp <= v_aweekago
    and coi_closed_yn = 'N';
    cursor c2 is
         select tsk_uid
         from s_tsk_task
         where tsk_status in ('C')
         and tsk_tty_code = 'CONTAC'
         and tsk_date_end = '' FOR UPDATE;     
    BEGIN
    select to_date(sysdate - 7) into v_aweekago from dual;
    DBMS_OUTPUT.PUT_LINE('System date used is ' || v_aweekago);
    FOR coi_row in c1 LOOP
    v_tsk_cnt := 0;
    v_coi_row_cnt := v_coi_row_cnt + 1;
    v_con_uid := rtrim(to_char(coi_row.coi_con_uid));
    v_tsk_act_str := ('"CON_UID","' || v_con_uid || '"') ;
    DBMS_OUTPUT.PUT_LINE('COI_CON_UID: ' || v_con_uid);
    DBMS_OUTPUT.PUT_LINE('v_tsk_act_str: ' || v_tsk_act_str);
    -----The Program is not entering into this Loop
              FOR tsk_row in c2 LOOP
              v_update_cnt := v_update_cnt + 1;
                   update s_tsk_task
                   set tsk_status = 'A'
                   where tsk_uid = tsk_row.tsk_uid and
                   tsk_action_string = v_tsk_act_str;     
                   DBMS_OUTPUT.PUT_LINE('----Task updated');                         
              END LOOP;
    END LOOP;
    COMMIT;

    using your query on your cursor c2 when you execute it on sql*plus did it return any rows?
      select tsk_uid
        from s_tsk_task
       where tsk_status in ('C')
         and tsk_tty_code = 'CONTAC'
         and tsk_date_end = ''; if not it might have something to do with the predicates in your where clause
         and tsk_date_end = '';consider revising your c2 cursor select statement to something like:
    cursor c2 is
      select tsk_uid
        from s_tsk_task
       where tsk_status   = 'C'
         and tsk_tty_code = 'CONTAC'
         and tsk_date_end IS NULL
      FOR UPDATE;

Maybe you are looking for

  • HDR Efex Pro 2 not working in LR5

    When I open HDR Efex Pro 2 from the "Edit With-" choices, LR duplicates each RAW file as a tiff. In this case, 3 images. All works as expected, except when it's time to save. My other Nik apps return a tiff file and stack it with the originals in LR.

  • Multiple JPEGs Kills Ps CS5

    This is weird, and not just a little annoying...  I have over 3,000 .jpg files to edit from a recent cross-country trip. The files were originally shot in RAW format and edited in ACR6.x in CS5, and now I wish to crop/stitch/&c. in Photoshop.  Howeve

  • Isolating print problems

    I've been using Aperture with a Canon MP800 printer with mostly good results. I'm an amateur photographer and right now I tend to print B&W on photo matte paper. Using the MP800's built-in presets for "colorsync profile" (and turning off color correc

  • I can't unmute my Notebook!

    Having a mare.. There is no sound on my notebook. If I try and unmute (pressing the 'volume up' button), an the speaker icon comes up in grey with the 'no entry' symbol HELP PLEASEEE!

  • Names of CSQ where the call dequeued

    hi, i have a scenario where there are 2 CSQs, if a call is queued for CSQ1 and was not answered by CSQ1's agent, it will be dequeued from CSQ1 then routed to and queued for CSQ2 ... my question .. is it possible to add any get contact/reporting info