07-11-2012 03:35 PM
@crossrulz wrote:
That's because you are closing the port on it via the lower portion of the code before you send a command. You also only need to setup the port once. Remove the Close Port at the end of the "manual" and wire the VISA session out from the Setup Port to both portions of code.
Ah ok, so like shown in attached pic
07-12-2012 06:36 AM
You still need to get rid of the second Configure Port, but yeah, you seem to be on the right track.
07-12-2012 03:12 PM - edited 07-12-2012 03:13 PM
OK, got the LED on the board turning on/off, however would it be possible to have a toggle switch turn it on and off? Right now I have to send 3 commands to get the LED on, and 1 command to turn it off. I have 4 events right now.
07-12-2012 04:13 PM
07-13-2012 06:04 AM
Use the Select function to choose which data set to use. That would be the easiest way.
07-13-2012 09:46 AM
@Albert.Geven wrote:
make a subvi from writing the command and call that in the event case.
Even better to call it outside the eventcase but start with making subvi's for functions and so make it easier to reuse the code in another case.
I'm not exactly sure what you mean, right now I have to press 3 buttons to get it on. Are you saying make 3 subVI's and somehow wire them to send out one after the other?
07-13-2012 01:46 PM
An event case is like an interrupthandler and programming an interrupthandler starts with: do nothing in an interupt that takes time.
One of the reasons is that while in an iterrupt you cannot handle new interrupts.
This is not important in your case but helps to keep your program readable.
Also the way you program the write is very detailed and if you look at the code for a button and for another button, you probably see the smae code twice.
Hiding those details in a subvi and creating a nice icon makes your code better readable and maybe also easier to extend.
To go back to the first item (the interrupthandler) look at the producer consumer template to see how this can be implemented in LabVIEW.