01-08-2018 09:27 AM
Hi everybody,
I am trying to control a Pulse Generator with LabVIEW. Sending the commands every iteration of a while loops did already worked out. However, it is unnecessary to send the commands every loop so I want to send the commands only when I change a value at the front panel. Therefore I was trying to use a event structure which worked out very well for all integer values. However, changing a boolean did not lead to the desired event. So far I found out, that I need to switch one "intermediate" toggle in order to switch the desired toggle. Switching the same toggle a few times did not lead to an event. I hope there is a simple solution for this.
I attached an excerpt of my VI.
Thanks to everybody who is trying to help!!
01-08-2018 09:56 AM
The only change you need to make is to put the Trigger control (on the Block Diagram) inside the "Trigger": Value Change Event. Did you notice that all of the Square Booleans have mechanical action "Latch when Released"? This means that their value ("On" or "Off") "sticks" until the control is read. This is ideal for an Event Loop if the control is inside that Event -- when the Event "fires", the Control is "returned to default state" (i.e. turned Off), ready for the next Push.
In your case, you read the Trigger at unspecified, unknown times that have no relationship to the Event Loop. Who knows what value will be seen?
Bob Schor
01-08-2018 10:14 AM
First Go HERE and download the instrument driver for that device.
Then go here and RTM. You are not doing what you think you are doing.
Several problems exist.
Then we can talk about actually using the instrument driver correctly.
open session once
Configure
Trigger
Configure
Trigger.....
Close session once.
01-08-2018 10:24 AM
Hi Bob_Schor,
first of all thank you very much for your help!
I`m sorry but I did not understood where the mistake is. Now I moved all boolean controls on the block diagram inside the respective event but nothing changed. I have still the same problems. As an expample:
When I start the VI and switch the output on, the command is executed. But than, I can switch the output toggle as often as I want, nothing will change, so I will not be able to turn the output off again unless I switch the polarity toggle and than the output toggle again. Now, because I switched the polarity toggle (the command was not exectued) the output at the Pulse Generator is switched off, so the command was executed.
I`m sorry, this is probably a stupid question, but I wasn`t able to figure out how to solve it yet.
Could you please modify the VI or give me a detailed explanation what I have to change?
Marv_92
01-08-2018 10:46 AM
Read what Jeff wrote, do what he said (especially about Reading), and think clearly about what you want to do (without worrying too much about how to do it).
If you want to explore the "hows", become a Scientist. Do an Experiment -- write a very tiny VI that has, say, three Boolean Controls, a Push Button, a Stop button, and an OK Button. Make three indicators -- Pushed?, Stopped?, and OK?. Drop a While Loop, put in an Event Structure, and make three Events, Push Button Change, Stop Change, and OK Change. Put the respective control in each Event Case and wire it to its Indicator. Also wire Stop to the While Loop's Stop indicator.
Now run it and play with it. If things happen too fast, turn on Highlight Execution (the light-bulb, the fifth icon on the Block Diagram Icon bar) and run it again. Learn.
Bob Schor