LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Highlight Execution code behaves differently.

Solved!
Go to solution

Hello all again hope everybody is well,

I have an application where I am sending commands to a power supply instrument to ramp up the power every 20 seconds then apply max power for 30 minutes and then ramp down power every 20 seconds to 0 power.

Application is case structured with no error executing and with error closing the session. Inside case structure I have for loop with array string control to send power commands with a visa write and another visa write to query the power and a visa read to display the power. In highlight execution mode, because is running slow everything works great, not so much in no highlight execution mode, where the power is not displayed. Power supply still ramping up holding the power and ramping down but nothing is displayed for power queried. I can see powers on the power supply display going to the sequence and timing is correct.

Any suggestion in how to read and display when application is running faster?

Thank you and best regards

0 Kudos
Message 1 of 9
(3,912 Views)

Post your VI.

 

My crystal ball is predicting your using bytes at port to figure out how much to read from the power supply. With highlight execution on, this gives the power supply enough time to respond and everything works. Without it on, after your write you immediately read and there are no bytes at the port, so nothing happens.

0 Kudos
Message 2 of 9
(3,894 Views)

Whenever it works differently under highlight execution there is a race condition.

 

Please show us your code so we can give more specific advice. Many things could be wrong.

0 Kudos
Message 3 of 9
(3,889 Views)

Lesker.png

Does this help?

0 Kudos
Message 4 of 9
(3,868 Views)
Solution
Accepted by topic author MariusS

The first problem is that you query the instrument immediately after setting the power level.  It's likely the instrument will not respond to a query while it is still doing whatever adjustments it is doing.  You should probably have some sort of delay between those two writes, or there may be some status register you can query until you get a response.

Secondly, you only read 12 bytes.  Unless you are positive the response is always smaller than 12 bytes, you should increase that to some amount greater than you ever expect to see, and trust in the term character to do it's job.

0 Kudos
Message 5 of 9
(3,856 Views)

Thank you again,

so I went back, and the final product works after inserting some delay timers. Power supply returns max. 5 bytes for a power reading query. Now I have a question where the Current Power buffer reading retains last value read, is there any way to reset that to 0 or not displaying anything after the vi is done?Untitled.png

0 Kudos
Message 6 of 9
(3,809 Views)
Solution
Accepted by topic author MariusS

@MariusS wrote:

Now I have a question where the Current Power buffer reading retains last value read, is there any way to reset that to 0 or not displaying anything after the vi is done?


Sure.  You can use an invoke node for the indicator to Reinitialize to Default, or you could use a local variable or value property node to set the value to whatever you want.

0 Kudos
Message 7 of 9
(3,790 Views)

@MariusS wrote:

Now I have a question where the Current Power buffer reading retains last value read, is there any way to reset that to 0 or not displaying anything after the vi is done?


Why would it matter what it displays when the VI is "done"? Or course you could write an empty string to it after the loop via a local variable, but why? If the VI is done, the value is irrelevant (or might even be interesting, because it is the "last seen" value). Once the VI starts again, it will be overwritten by a new value anyway. If you want to clear all indicators the next time the VI is run, configure that in "VI properties...execution").

 

You really should not use "in-place element structure" frames as a replacement for simple sequence frames. While it works, that's not the right tool for the job. Who gave you that idea?

 

Also, your "one-iteration FOR loop" serves no purpose.

0 Kudos
Message 8 of 9
(3,782 Views)

Thank you for the input, because I have several ramp up input powers more like ten of them I need to see that once is going thru cycle and done nothing is displaying. I am sure with good suggestions my app will evolve. I've been using Lab View for three months now I still have a lot to learn. Thank you again and have a fantastic day.

0 Kudos
Message 9 of 9
(3,758 Views)