LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending data periodically to VISA write

I have been trying to send data to VISA write to operate some relay boards. The relays work fine but I am having trouble sending the data as I need to. I either get a rapid constant repeat of the relays operating using a while loop or they just work once and not again until I restart the vi. I need to trigger the VISA write once when my various timed loops require an action (and again to send a relay off message).
0 Kudos
Message 1 of 9
(5,483 Views)
It sounds like you may have issues with your loop rates, case statements, or use of shift registers.  I would recommend posting the code that you are using along with anymore details that may not be obvious from viewing the code such as what the actions for the timed loops would be.
0 Kudos
Message 2 of 9
(5,457 Views)

Thank you very much for the advice. I will put something together to send this morning, as we are still working on the first stages of this project and there have only been simulations so far.

Alastair

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

Ok, this has taken me by surprise. I have knocked together an example of what I am trying to do. I thought that the excessive use of while loops would cause the relays to operate repeatedly when auto control of VISA write is enabled, but for some reason this .vi works perfectly! Thank you again for your help, and I realise that now things are working I don't need any more help (until the next problem!) but if you have a moment, could you suggest why the relays now operate once when asked rather than as quickly as Labview can switch them?

Sorry for the v8.0 .vi, I am using v8.2 and this is the only older version it will save as. All the gear, no idea. I apologise for my lack of knowledge, but I am a scientist rather than an engineer or programmer!

Thank you,

Alastair

0 Kudos
Message 4 of 9
(5,431 Views)

somebody once said:

"using the abbort button to stop a vi is like stoping a car with a tree. it will work, but there might be consequences". original poster please remind me who it is Smiley Very Happy

to the point:
- none of your loops includes a stop button.
- there are 2 loops which spins like there is no tomorow: they need a small wait time in there
- the first loop iteration time will be the longest delay time. in your case every pump/mixer should be independant if i understand correctly what you are trying to do (you will loose phase tough. and since you claim the system is working perfectly, i suspect what you intended to do differ from what is observed on the front panel. if you want single timing of all pumps, maybe one single control is enough then).
- since the open/close time in your pumps is in seconds, you might want to write to visa only when there is actual change of state. then simply queue the commands to send out. the whole thing could be set in a single loop.

just my 2 euro cents (worth much more these days Smiley Very Happy )

 



Message Edited by Gabi1 on 11-28-2007 01:46 PM
-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
Message 5 of 9
(5,419 Views)

Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

thats the signature of Ed Dickens i just remembered. but i suspect he asked somebody the right to use it. Ed?

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 6 of 9
(5,417 Views)

Thanks. I appreciate that there are no stops on the loops, but I get so sick of the huge quantity of them accumulating and having to hide them somewhere on the front panel. I have tried before to make a master stop switch with local variables but it doesn't seem to work. I guess there is an easy way but my lack of experience is obviously showing.

You are absolutely right about the sequence structures sharing the while loop, I realised this when demonstrating it to a colleague and have since put them in individual while loops. The seconds timings are just for demonstration. I think the real process will be operating at least the pumps on a roughly hourly basis for a few minutes each time, the mixers will be subject to a wider range of experimentation periods from maybe one minute per hour to permanently on (for which I would by-pass the timing for a switch arrangement).

Your input was certainly worth more than 2 cents,

Many thanks,

Alastair

0 Kudos
Message 7 of 9
(5,400 Views)

If you used multiple stop buttons, one for each loop, hiding them on the front panel kind of defeats the purpose of having them. Smiley Wink

You only need one stop button.  Make copies of a local variable of it to wire into the conditional terminals of the other loops.  Because it has local variables, you won't be able to use the latching mechanical action which allows the button to pop back up once it has been read.  You will need the switching action.  But you can add a final sequence to your code that writes a false to the local variable after all loops have ended so it will appear to behave like a latching button resetting itself once the program ends.

0 Kudos
Message 8 of 9
(5,396 Views)

That would explain my lack of success. I am still trying to get used to local variables, and most other things in the software.

Thanks again,

Alastair

0 Kudos
Message 9 of 9
(5,391 Views)