12-05-2011 11:05 AM
Hey,
This is kind of a basic question, and I'm not sure how up to par I am on LabView FPGA vocabulary. I basically have a state machine that performs a task, and I want two of these state machines to be running at the same time. So I created a subVI with the state machine and placed two calls to them in the top level VI.
The problem is when I run the top level VI in interactive mode the initial inputs are latched, and subsequent changes to the inputs doesn't do anything. So, basically there is something I don't quite understand. I was picturing the signals propagating from the top level VI to the two instances of the subVIs instead of the initial values being stored.
What am I doing wrong?
Thanks,
Kevin
Solved! Go to Solution.
12-07-2011 03:11 PM
Hello kevin.key,
Could you please upload your code so that I can get a better understanding of what is going on in this situation.
Thanks
12-07-2011 03:31 PM
I changed stuff so I don't have the code anymore, but here is a better description:
Top Level
Two SubVI calls with parameters wired in
SubVI
While Loop with case structure for each state and the states are changed by reading the state of some signals
The parameters are used to change the response in each state
The state machine runs continuously the whole time and only stops when the system is shutdown
Problem
Changing the parameters does not propagate to the SubVI. The SubVI retains the initial parameter values until shutdown.
12-08-2011 06:42 PM
Hello kevin.key,
Can you create an example VI that replicates this behavior so that I can take a look at it. Thanks,
12-09-2011 07:28 AM
12-09-2011 07:47 AM
Just kidding.
This is a simplified version that probably doesn't capture all the reasons why it seemed like a good idea to set things up this way. But it's basically a picture of what I was saying. There's a state machine in the SubVI that I want to be able to change the parameters going to. In my mind I was picturing 32 signals wired into each of these blocks that weren't initially latched so by changing them the signals would just propagate into the SubVI, and I had the SubVI latch them at a particular point in the state machine. But this obviously isn't the behavior I was seeing. What I was seeing was that the initial values were latched and changing them in the Top Level VI didn't propagate new values into the SubVI.
Thanks,
Kevin
12-09-2011 01:28 PM
12-13-2011 04:27 PM
Hello kevin.key,
I was looking over the VIs you posted and have a few suggestions that may help you in developing state machines. Highlight Execution is a useful tool for seeing data flow in your VIs, if you use this while running your main VI you can see that the data flow stops at the subVI. Based on the structure of your subVI, your while loop does not stop and output data to the main VI.
Here is a useful document on State Machines.
State Machines
https://decibel.ni.com/content/groups/northeast-oh-labview-users/blog/2009/09/08/state-machines
In addition you can also create a new state machine VI from template by going to,
File New>VI>From Template>Frameworks>Design Patterns>Standard State Machine
12-14-2011 07:32 AM
Thanks, but I don't need any help understanding state machines and you can't do execution highlighting in an FPGA VI. My question really doesn't have anything to do with state machines. My question pertains to LabView FPGA. If you look at my previous post and the image I uploaded, understanding the difference between the two would be helpful. And is it possible to create a SubVI in LabView FPGA that doesn't latch the initial input values?
12-19-2011 04:59 PM
Hello kevin.key,
The difference between both parts of the code you attached is that the code in the while loop will run multiple times until stopped while the code without the loop will only run one and then stop.
Your SubVI will latch values based on the input values passed from your top VI. These values will be updated each time your subVI is called from your top VI. In order for this to occur your top VI needs a loop to continuously pass data and your subVI needs to loop independently of your top VI. The reason the values in your front panel are not getting updated is because there is no loop in your top VI. If you include a loop the values will only update every time the loop executes, which only occurs after everything inside the loop finishes, including the subVI.
If you have access to a computer with LabVIEW on it try running you VIs using highlight execution to see the behavior in your subVI.