Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending out in decimal, reading in hex


@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

0 Kudos
Message 41 of 47
(1,569 Views)

You still need to get rid of the second Configure Port, but yeah, you seem to be on the right track.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 42 of 47
(1,564 Views)

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.

 

0 Kudos
Message 43 of 47
(1,550 Views)

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.

greetings from the Netherlands
Message 44 of 47
(1,546 Views)

Use the Select function to choose which data set to use.  That would be the easiest way.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 45 of 47
(1,540 Views)

@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?

0 Kudos
Message 46 of 47
(1,535 Views)

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.

greetings from the Netherlands
0 Kudos
Message 47 of 47
(1,528 Views)