From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA subVI Multiple Instances

Solved!
Go to solution

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

0 Kudos
Message 1 of 12
(3,189 Views)

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

Applications Engineer
National Instruments
0 Kudos
Message 2 of 12
(3,167 Views)

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.

0 Kudos
Message 3 of 12
(3,163 Views)

Hello kevin.key,

 

Can you create an example VI that replicates this behavior so that I can take a look at it. Thanks,

Applications Engineer
National Instruments
0 Kudos
Message 4 of 12
(3,149 Views)

Nope.

0 Kudos
Message 5 of 12
(3,137 Views)

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

Download All
0 Kudos
Message 6 of 12
(3,134 Views)

Also, here is another fundamental question that I seem to be stumbling over when it comes to LabVIEW FPGA:

 

What is the difference between the top part and the bottom part?

0 Kudos
Message 7 of 12
(3,125 Views)

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

Applications Engineer
National Instruments
0 Kudos
Message 8 of 12
(3,088 Views)

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?

0 Kudos
Message 9 of 12
(3,078 Views)
Solution
Accepted by topic author kevin.key

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.

Applications Engineer
National Instruments
0 Kudos
Message 10 of 12
(3,043 Views)