02-01-2017 04:05 AM - edited 02-01-2017 04:12 AM
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
02-01-2017 07:47 AM
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).
02-01-2017 09:10 AM
@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.
02-01-2017 09:21 AM
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.