LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State Machine Implementation

Apok,

You are correct:  the 'First Call?' VI will not work for what I need to accomplish.  I did try your previous mod and the current version (StateMachine_SurferEE_05) incorporates your code with minor changes.  I have not deviated much from your original code; everything that has changed is cosmetic and has to do with how I am handling the shift registers/outputs.  As stated in a previous post the only major change is modification of the outer while loop timer to 1000 ms.  This forces the program to run on a 1s interval which is fine for my application.  I do not require it to run faster than that.  My current issue is how to capture the first (or second) sample when the 'Read' state is entered.  My logic works for the 20th sample but I am having issues getting the first.  In this version I have added logic to output between 1s and 2s but I end up with the 3rd sample.  Should I drop the while loop wait time and try for ms resolution within the state machine?  Does my latest VI make sense to you?

I surf therefore I am....
0 Kudos
Message 31 of 34
(554 Views)

Here is an update with the deltas calculated.  This is essentially what I am after.  After each read, the delta of the sensor at 1s and 20s will tell me how to drive the LED logic.  If it is beyond a calculated threshold then the LED will be active.  Does this make sense?

I surf therefore I am....
0 Kudos
Message 32 of 34
(551 Views)

i dont understand this reasoning? btw, change the Wait ms back to 50...what you did does not benefit the vi but slows the front panel user interface

 

Spoiler
StateMachine_SurferEE_05[1]_BD.png

 

but you can try this, which matches the last code i did....

 

Spoiler
StateMachine_SurferEE_05[1]_2.png

 

0 Kudos
Message 33 of 34
(545 Views)

Apok,

The first picture shows logic that reads true if the time elapsed is between 1 and 2 seconds.  I need a reading at 0.1 seconds and the last reading at 25 seconds.  My apologies for changing the window but based on the responses I am seeing I need better resolution.  The code you are suggesting will not work as it outputs every second until 20 seconds when the state will change?  I need a finite value sampled at 0.1 seconds and then another at 25 seconds.  All other samples are irrelevant and not needed. Are you following what I am trying to explain?  If you are confused I will try to clarify.  I have attached my latest attempt.

I surf therefore I am....
0 Kudos
Message 34 of 34
(532 Views)