LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending unsigned byte array to serial port

I would like to send a string of hexadecimal values to the serial port (using the "VISA write" block).

 

At the moment, I have a working design that will take a string of hex values, and convert them into an unsigned byte array.

 

However, it would seem that the "VISA write" block only accepts a string as its input.

 

If I use the "Byte array to string" block, then I can only convert the hex values that correspond directly to ascii characters.  I.e. it will only convert hex values that lie between 0x20 and 0x7E.  However, I need to be able to send values in the range 0x01 to 0xF8.

 

Any suggestions welcome.

 

Dan

Dan
CLD
0 Kudos
Message 1 of 7
(7,710 Views)
Have you tried using escape sequence? For example \20 is a space, \30 is 0.
0 Kudos
Message 2 of 7
(7,699 Views)

DanB1983 wrote: 

If I use the "Byte array to string" block, then I can only convert the hex values that correspond directly to ascii characters.  I.e. it will only convert hex values that lie between 0x20 and 0x7E.  However, I need to be able to send values in the range 0x01 to 0xF8.


No it doesn't. Why would you think that?

 

Message Edited by smercurio_fc on 07-22-2009 08:49 AM
Message 3 of 7
(7,695 Views)

Hello,

 

I have also used typecast:

 

typeCast.PNG

 

It really depends on how explicit you want the code to be, using Byte array to string is more obvious. Both execute in less than a millisecond on my machine.

0 Kudos
Message 4 of 7
(7,655 Views)
Never mind. I didn't see all the other replies before I started typing mine.
Message Edited by Ravens Fan on 07-30-2009 12:30 AM
0 Kudos
Message 5 of 7
(7,628 Views)

Hello,

 

please if you have found the solution told me I have the same problem

0 Kudos
Message 6 of 7
(4,198 Views)

What specifically is your problem? As explained above, there is no problem with converting between byte arrays and strings.

0 Kudos
Message 7 of 7
(4,189 Views)