LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

state machine program in LabVIEW

If anyone can help me towards converting this program into state-machine style.

This existing program is reading mA signals for (torque and RPM) and displays it on chart , can logged the data and print later on.

Can I convert this into state-machine? How it going to work? Do I need a button to switch between the states? For example when I need to start getting data (Acquisition ) , and its upto me whenever I want I  can start logging and can stop the program , clear it and then exit from the program .

I have possible states in my mind , like ; initializing , start, logging , report, stop, exit , …but the problem is I don’t know how to use state-machine using push buttons (user interface)

A quick response will be highly appreciated.

Thanks

Fayasoft

0 Kudos
Message 1 of 5
(3,422 Views)
1) http://zone.ni.com/devzone/cda/tut/p/id/3024
2) http://zone.ni.com/devzone/cda/epd/p/id/3059

2) or Get the NI State Diagram Toolkit
3) or pehaps consult an Alliance member

-Chroma
0 Kudos
Message 2 of 5
(3,414 Views)
Please understand that it would be to much work to redesign your code ! Attached example will show the basics on how to use a state machine with UI actions. Its really easy !
0 Kudos
Message 3 of 5
(3,402 Views)

Hello JB,

Thanks for the suggestion and sample program. I tried and it worked but there is still a problem.

there are couple of states in my program , one of them is Signal Acquiring and other state is Data Logging.

in the begining i press "signal acquiring" button and program displays it on the graph . as soon as I press "Start Logging" , lets say if i log data for 5 min , and after 5 min if i open log file the data is there but pressing log option stops displaying at the graph during logging time.

how can I prevent this situation.

Thanks,

Fayasoft

 

0 Kudos
Message 4 of 5
(3,339 Views)
It sounds like your displaying to the graph is occuring only in the start acquiring case of the state machine case structure.  You should move the part of the code that sends the data to the graph completely outside the case structure.  Or better yet, look at the architecutres that have producer consumer loops.
 
If you run into problems, post the .vi.
0 Kudos
Message 5 of 5
(3,321 Views)