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.
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.
11-04-2014 06:56 AM
Hello!
With the help of user Dennis Knudson and NI support engineer Denis Stavila (both of whom I thank very much )
I managed to communicate with this HighVoltage source (vi.jpg).
The problem is that the VI sends duplicate commands(please see attached image"dublu.jpg"):
The duplication of the command is true for any function: set voltage,set step voltage,quit, everyone is sent/answered to/sent/answered to.
I am a beginner so it may be a simple setting of the event case or the controls that I overlooked.
When I use the manufacturer's visual basic control software it sends the commands once;
when I use a simple VI made by me (simpl.jpg) ,again, it sends the commands once which is ok.
Why does the VI send the same command twice?
Solved! Go to Solution.
11-04-2014 07:06 AM
It is a bit hard to debug without you posting your actual VI. Please post them.
Your architecture seems a bit off:
Instead of having "set vmax" inside of the event stucture (it looks like initialization code) either have it outside and to the left of the while loop or use the simple state machine that labview ships with and have an initialization case that only will run once to get connected to the instrument.
Also have the button changes set up in the event structure with corresponding code inside of the event structure. For example, do a value change on "vou"t inside of the event structure.
Do you have way to stop communication when you go to exit your program? If not, have this to the right of the program outside of the while loop and use an error wire to enforce dataflow or use a simple state machine with an exit case.
11-04-2014 08:10 AM - edited 11-04-2014 08:13 AM
SetMax and SetStep do two things:
1-they command the max value of the Vout knob and its scale increment
2-when the buttons SetMaxV and setStep are pressed, they send the command to visa write buffer through the converters from number to string.
I don't know how I could insert them into a case and still have them controlling the Vout knob
But here is the VI
PS: taking the triggers outside the while loop did not work either.
11-04-2014 08:11 AM
11-04-2014 08:21 AM
I think you get your values twice because you enter when the event is TRUE and once when the event is FALSE...
+ you should check your Visa Read for the amount of chars available before reading 2.
11-04-2014 08:37 AM
You are opening and closing the visa everytime you write a command. Just open and close it once before and after the while loop.
Use shift registers to pass data between loop iterations.
Delete the timeout case if you aren't going to use it.
The top 100 ms timer seems unnecessary.
Clean your wires so they go left to write and no big bends.
I have attached a VI with some code that will hopefully put you on the right track.
Do some labview training as some of these are basic concepts and are need to make proficient code.
11-04-2014 08:46 AM - edited 11-04-2014 08:49 AM
Make sure that boolean is not switch until released. (Latch when released would be perfered) If it is switch until released of course there are two events fired.
And "Bingo"
11-04-2014 10:40 AM
Thank you !
tomorrow morning,at work,where I have Labview, I will do everything you advised me to.
But first I have to understand it: shift registers
I will reply as soon as I get the results.
Thank all of you again!
11-05-2014 01:38 AM
Bingo indeed !
""Latch when pressed"" was the answer.
Thank you, Jeff·Þ·Bohrer !
I would also like to thank everyone else for their advice: it will help me become a better labview user.
11-05-2014 02:36 AM
Another question:
at start up, even if the previous time I had selected volume knob Scale to start from 0,
it starts from -1 .Why?
-how can I make labview remember my settings, I mean change the default values that it now has -1 for min scale to 0,
set Step to 100 instead of 0, Vmax to 1000 instead of zero?
But the most important question: when I press RUN, is there a way (there has to be a way)...
what is the way to do this:
press RUN => labview sends a READ command to the physical object to receive info. Vout setting, Vstep setting, Vmax setting
receives this information and updates the labview values fot Vout,Vstep and Vmax?
Let's say the values set on the voltage source are Vout=0V, Vmax=1000V, Vstep=100v .
When I hit RUN in labview, it sends a read Vout,readVmax,readVstep
and updates the labview controls : sets the Vout knob to 0, Vmax to 1000, Vstep to 100.
How would I do that?
1-link a read command to the RUN button?
2-make a loop that updates the values of Vmax,Vstep (so use another property node for Vmax,Vstep that is controlled by visa read)
How do I do 1?