LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State Machine Implementation

How long will the first reading take place?  I recommend initializing a numeric control (in the initialize state) to this value and using it as an input of your READ state.  During the cooldown state, change the value to that for 60 seconds.

0 Kudos
Message 11 of 34
(1,118 Views)

Please see the updated VI I uploaded in response to Apok's last post.  The initialize state will now just be done outside the while loop.  I would rather not use a control since this functionality should not be visible/usable by the user.  Thank you for your help.

I surf therefore I am....
0 Kudos
Message 12 of 34
(1,112 Views)

Sorry I can't view the VI as I have an older version (2009).  In programming you will encounter a lot of situations where you want to use a control or indicator to store values but don't want the user to see them.  You can either move them off the visible portion of the front panel, or hide them.

 

right click on the Control- > Advnaced - > Hide Control

0 Kudos
Message 13 of 34
(1,109 Views)

Updated State Machine code attached.

 

 

I surf therefore I am....
0 Kudos
Message 14 of 34
(1,106 Views)

ok...here it is, hopefully it represents, take note of the error handling

 

note: after running it a few times i need to reinitialize the elapsed timer by using a bool shift reg....

0 Kudos
Message 15 of 34
(1,103 Views)

Apok,

It looks good so far.  Let me digest the code for a while and tweak it to my specs.  Nice work on using the 'first call' VI that was clever.  I am off for the weekend in a few hours so may not repost until Monday.  Thank you so much for your help on this and other threads you have replied to.  You rock bro!

I surf therefore I am....
0 Kudos
Message 16 of 34
(1,094 Views)

Any chance you can repost your code in an earler version? I am running 2011 and would like to see what I can learn from this thread to improve my implementation of state machines.  Thanks!

 

Jeff

 


@apok wrote:

ok...here it is, hopefully it represents, take note of the error handling

 

note: after running it a few times i need to reinitialize the elapsed timer by using a bool shift reg....


 

Jeffrey Zola
0 Kudos
Message 17 of 34
(1,066 Views)

@Jeffrey_Zola wrote:

Any chance you can repost your code in an earler version? I am running 2011 and would like to see what I can learn from this thread to improve my implementation of state machines.  Thanks!

 

Jeff

 


ok, this is the new and improved ver9.0...surferEE, just change the time constants of the elapsed timers to suit your needs  Smiley Wink

0 Kudos
Message 18 of 34
(1,061 Views)

Apok,

I am looking through your code now and have updated mine from last week.  I have added the DAQ code to give you a better idea of what I am trying to accomplish.  During the 'Read' cycle the DAQ is to output 5V on Port 0 lines 0-2 and take a sample each second for 20 seconds on analog inputs Ai0, Ai3 and Ai4.  These samples are then output to a 2D array.  Each column represents each individual analog channel.  Once I have all 20 samples for each channel, I subtract the first sample from the last sample and output the difference to a numeric indicator.  I have not yet implemented your new code into the VI I have attached. 

 

**Updated:  I have implemented the parts of your code from version 9.  I changed the timing constants as needed as well.  I am having trouble getting the array to build properly and using it after the 'Read' state.***

I surf therefore I am....
0 Kudos
Message 19 of 34
(1,018 Views)

Jeff,

No worries, I can save to 2011 format once the code is in better shape.  Please email me so the thread does not get hijacked.  I will send you the VI when we are done.

I surf therefore I am....
0 Kudos
Message 20 of 34
(1,004 Views)