Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How send numerical values through VISA Serial Write... because VISA Serial Write only sends strings???

Hi folks,

 

I want to send "numerical values" (0 - 255) through the VISA Write (Serial) the problem is that this VI only lend me to send "strings"... and I need to send numbers. Check below please!

 

!:D.png

 

Thank You!

0 Kudos
Message 1 of 3
(4,624 Views)

A byte is a byte. Whether the program interprets it as a string or as a numeric depends on the programmer.

 

Here is one way to do it. The Build Array creates a one-element array which is then converted to a one-character string by Byte Array to String.

 

Byte to String.png

 

You do not need the sequence structure. Dataflow will force the C to be written before the numeric array. Sequence structures should be avoided as they break dataflow and are rarely needed.

 

Generally you should not wire N and use autoindexing simultaneously. However it you only want the first 8 elements of a longer Columnas array, then what you show is acceptable.

 

It may not be a good idea to have the VISA Write inside the event structure. The event structure locks the fornt panel by default until the code inside completes execution. If for some reason the serial port was not working the program would be locked up until the 10 second timeout elapsed.

 

The VISA Session and error wires should be wired though every case of the event structure. Use Default if Unwired on those tunnels may result in the VISA sesson not being closed or an error not being reported.

 

Lynn

0 Kudos
Message 2 of 3
(4,618 Views)

I wouldn't even use the FOR loop.  Just use the Byte Array To String and the resulting string to the VISA Write.


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 3 of 3
(4,615 Views)