LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data transfer via serial port

I'm currently  using labview as a testbench for my project.

i want to send numeric values from one pc to another. but the visa write buffer accepts data only as text which is then serially transfered.

how will i be able to transfer numeric data to another com???

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

Hi Vicky,

 

The visa write function accepts strings, not text.  What I do is build an unsigned byte array, and pass it through the "Byte Array to string" function.  This allows me to send out bytes from 0x00 to 0xFF.

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

Technically, strings are text. Smiley Wink

 

You would only need to use byte arrays if you need to send out values in hex, as opposed to just numeric numbers. For example, to set a voltage you typically send out the string "VOLT 3.0". You would not send out this string as a byte array. The instrument would simply not understand it. To poster: Do you need to send out the number as a number, or as its hex value? If you just need to send it out as a number in string format, then just use the numeric -> string conversion functions in the String -> String/Number Conversion palette.

0 Kudos
Message 3 of 4
(3,202 Views)

Hi Smercurio_FC,

 

Well,  I tend to think of "text" as those characters you would use to, say, compose a sentence.  My point was that a string can also contain non-visible characters as well.  Most of my applications communicate with binary data (byte values from 0 to 255), not ASCII.  I assumed that since it was from one PC to another, that the OP was not communication to an instrument, which 95% of the time is strictly an ASCII based protocol.

 

I agree the question needs further clarification.  I would rephrase your question to the OP as: "To Poster: Do you need to send out the number in its native representation (byte = 8 bits, word = 2 Bytes, long = 2 words, etc) or as it's text equivalent? "

 

If the communication is between two labview programs, via the serial port, how about using the flatten/ unflatten to string functions?

0 Kudos
Message 4 of 4
(3,191 Views)