LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

state machine

Hi,

I am new to labview and trying an appliction with the help of state machine concept.
My application is to configure a voltage device with the DLL functions.
Below is the explination of events and description of DLLs.
1. state Initialize: initializes and wait fot the event.
1. connect event: device is connected and returns back to wait for the event
    connect Dll : this dll function interface the connection of the device through ethernet.
    which i stated as CONNECT event in wait for event case.
2. Run event: can read and write the commands with two other dlls: SET DLL and GET DLL
   ex: SET DLL :voltage set = 11 and this sets the voltage to 11 volts
       GET DLL :voltage get = reads teh voltage and returns 11 volts.
       GET DLL :voltagemeasure = reads the measured voltage 11.01 volts. voltage measure is
    not constant and therefore fluctuates. so I have a while loop for this dll which reads the voltage measure continously and cannot be interrupted.
  My question:

  Is there any possibility to check the inputs from set and get items outside the while
  loop for every 500 milli seconds and to read the new values if there is a change in the voltage set.    
  or any new event to run the while loop and continously and reset with new RUN event values??

 

Please find the attached vi example.


Thank you in advance.

Regards,
valleru

0 Kudos
Message 1 of 4
(2,476 Views)

Based on what I see, I would not even use a state machine.  Do your initialization before your main loop and do whatever shutdown after.  Inside of the loop, you just need an Event Structure.  If you are connected to your device, have a timeout case (something like 100ms would probably be plenty) where you do your GETs.  If you are not connected, have your timeout be -1 (wait forever).  You will need to store your timeout in a shift register to do this.  And your other event cases would be when you change your set voltage and when you change your power (Value Change events on your front panel controls).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(2,421 Views)

@crossrulz wrote:

Based on what I see, I would not even use a state machine.  Do your initialization before your main loop and do whatever shutdown after.  Inside of the loop, you just need an Event Structure.  If you are connected to your device, have a timeout case (something like 100ms would probably be plenty) where you do your GETs.  If you are not connected, have your timeout be -1 (wait forever).  You will need to store your timeout in a shift register to do this.  And your other event cases would be when you change your set voltage and when you change your power (Value Change events on your front panel controls).


I think the OP might be trying to learn how to do a state machine.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 4
(2,408 Views)

Using a state machine will allow for the ability to extend the functionality of the application.  I recommend opening LabVIEW, from the menu select File->Create Project.  The "Simple State Machine" is a great place to start although "Finite Measurement" or "Continous Measurement and Logging" may be appropriate.

CLA
0 Kudos
Message 4 of 4
(2,400 Views)