LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

EVENT STRUCTURE INDICATORS

Hi guys,

I am having a problem with my event structure code.

When the HOST VI is run, the input values on the indicators gets updated only when the same value is entered the second time in the controls.

With the oscilloscope, the value entered in control is updated as expected (just from a single entry), which is OK.

How can I make the  values on the  HOST indicators to update correctly from a single entry of the input values in the control?

Any hint or suggestion will be highly appreciated.

 

Best Regards,

OPUK

 

 

 

Download All
0 Kudos
Message 1 of 14
(4,236 Views)

I don't completely understand the way you are describing your code is supposed to run.

 

So let me point out where I see problems.

 

In your FPGA code.  your outer while loop is pointless.  Your Inner while loop has a false wired to the conditional terminal which means it will run forever.  The outer while loop will never iterate again.

 

In your host code, the inner while loop is pointless since it is set with a True wired to the conditional terminal.  That means it will only run one time.  Your outer while loop will run forever which means your code after the while loop can never run.  You are forced to abort your code in order to stop it.

 

Now in that outer while loop, you have an event structure.  That means your outer while loop will only iterate whenever an event happens.  Perhaps you should wire a value into the timeout node of the event structure?

 

I think you really need to sit down and write out a flow chart to describe how your code is supposed to operate.  Right now you don't see to be following the rules of dataflow within LabVIEW and that is causing you to not see it operate the way you want it to.

0 Kudos
Message 2 of 14
(4,227 Views)

Thanks for the prompt response RavensFan.

Actually the code runs OK (from the oscilloscope). My problems is with the values displayed on the indicators!!!!!.

For example, from the host vi, if a value of 10 is typed on the control (Final destination X (um) while the vi is running, the indicator (Move Indicator X) should display a value 8194. This is no the case in my code. What is the possible cause?

 

 

Best Regards,

Opuk

 

0 Kudos
Message 3 of 14
(4,205 Views)

When you do something that would fire an event, the event structure stops waiting, it handles that event, the outer while loop finishes and iterates again, thus allowing the indicators to get new values.

 

You are asking for the indicators to update even when you don't want an event to happen.  To do that, wire a value into the timeout node of the event structure.  The code will either handle an event, or after so many milliseconds, the timeout case will run.  That case might do nothing, but it will allow the outer while loop to iterate, thus updating the indicators again.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 4 of 14
(4,169 Views)

Hi RavensFan,

You just solved my problem. It worked so perfectly. Thank you so much for the assistance. Let me also go through the online LABVIEW tutorials as suggested.

One more concern, Is it possible to autowrite to the Final destination Y (um) the valued keyed in Final destination X (um)? I mean, if I key in a value 10 in Final destination X (um) I want the same value 10 to be transferred to Final destination Y (um) without literally keying in the value 10 manually. I hope my description is clear. Is this possible?

 

Best Regards,

Opuk 

0 Kudos
Message 5 of 14
(4,133 Views)

Yes.  Just write to the value property node of the other other control when the event fires for the first control.

 

The only issue under what circumstances do you want the other control to get the same value, and what circumstances do you not want to because you want to enter different values to each one?  How would the program know when to write to both, and when not to?

0 Kudos
Message 6 of 14
(4,123 Views)

Hi RavensFan,

Thanks a million. I used the property node and it worked. The only concern is that I want the value fired by the first control to be the default value in second control, but I should have the freedom to input a different value when I need to. So the second option of keying in a different value is what am figuring out now. Because I think the option is necessary. Thank you.

 

 

Best Regards,

Opuk

0 Kudos
Message 7 of 14
(4,087 Views)

You could do an option I've seen in graphics programs where there is a push button with a chain on it when pressed that lockds two inputs together such as when you want to scale something in the X and Y directions the same amount.   And the pushbutton when not pressed has a broken chain link on it and the X and Y values are not linked to each other  and you can enter different values for each.

 

With that, you can read the boolean in the event structure.  If the boolean is False, you just allow it to update the one control.  If it is True, then you update both controls by way of their property nodes.

0 Kudos
Message 8 of 14
(4,076 Views)

Hi

I have used a selector and a boolean switch to either auto input the value from X when the boolean switch is OFF or put in manually the value of Y when the boolean switch is ON. Thanks alot for the advise. My only concerns is that when the move speed is high (lesser wait time), my analog outputs  viewed from oscilloscope are not synchronized. The Y output (green) lags. Is there a way we can get this to synchronize? 

 

Best Regards,

Opuk

0 Kudos
Message 9 of 14
(4,049 Views)

How long is the lag according to the scope?  Does it seem equivalent to a iteration time of your while loop in your FPGA code?  It may be possible that the X move is getting written first and starts before the Y move is written, and then that isn't seen until the next loop iteration.

 

If this is critical for you, you may need to do something different with your code to guarantee they are written at the same time.  Perhaps instead of 2 front panel indicators, have one that is a cluster of X and Y.  That should guarantee that the FPGA sees the two values change at the same time since they will be in the same control.

 

Then the only question is how quickly the X and Y analog outputs get updated, which I hiope would be near simultaneously since they are in the same IO node.

0 Kudos
Message 10 of 14
(4,031 Views)