04-18-2013 03:38 PM
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.
04-18-2013 03:50 PM
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.
04-18-2013 03:53 PM - edited 04-18-2013 03:54 PM
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
04-18-2013 03:59 PM
Updated State Machine code attached.
04-18-2013 04:08 PM - edited 04-18-2013 04:19 PM
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....
04-18-2013 04:18 PM
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!
04-19-2013 12:48 PM
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....
04-19-2013 01:10 PM - edited 04-19-2013 01:13 PM
@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
04-22-2013 10:16 AM - edited 04-22-2013 10:46 AM
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.***
04-22-2013 10:57 AM
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.