LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send HEX data by LabView TCP Socket

using LabView2015, string data can be sent by TCP/Socket, How to send HEX data ? 

0 Kudos
Message 1 of 17
(6,995 Views)

There is typically some kind of message protocol you have to follow to talk to your device.  Please share that protocol so we know exactly it is you need.  I have seen too many versions of "Hex" data to feel comfortable giving an answer with that exact protocol.


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 2 of 17
(6,938 Views)

Right click on the "data in" constant or control wired to the TCP Write function and select Visible Items -> Display Style and then select Hex Display. You can also wire an array of bytes to the data in input.

write TCP.png

Lucian
CLA
0 Kudos
Message 3 of 17
(6,913 Views)

Thanks.

but I can't find the way to use in LabView2015.

do you have such a vi file ? would u like to attach a copy.

0 Kudos
Message 4 of 17
(6,774 Views)

@huaew wrote:

Thanks.

but I can't find the way to use in LabView2015.

do you have such a vi file ? would u like to attach a copy.


You were given steps to produce the code.  Did you try it?


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 5 of 17
(6,678 Views)

@huaew wrote:

using LabView2015, string data can be sent by TCP/Socket, How to send HEX data ? 


A string can contain all types of numbers, even hexdecimal numbers. 
Example:

RolfO_1-1577726709048.png

Do you need help for how to format a integer to a hexadecimal string or do you need to send a byte or byte array.
Since a byte just contain a value between 0 and 255 (decimal) your question is a little misleading if you ask for how to send hexadecimal data.

I would like to ask the same question as crossrulz, could you share information about your  message protocol.

0 Kudos
Message 6 of 17
(5,990 Views)

I want to send byte array. such as send 0x08 0xa0 0xe0.

0 Kudos
Message 7 of 17
(5,385 Views)

Hi huaew,

 

you still don't attach your VI…

 


@huaew wrote:

I want to send byte array. such as send 0x08 0xa0 0xe0.


  1. Then you need to create an array constant.
  2. Place a "byte" (aka U8 integer) constant in the array constant.
  3. Change the display style of that U8 constant to show hex formatted values and show the display style indication…

This is pretty basic LabVIEW knowledge: did you take note of those "Training resources" offered here?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 17
(5,378 Views)

Excuse me if I am opening an old forum, I need to send the frame string "Trama_Elip.T_Definitiva_ELIP" in hexadecimal format (I am attaching an example of the frame:

 

4C410000203030303229317CAA05A09900000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000030000000000000 ).

 

I tried this way "Right click on the "data in" constant or control wired to the TCP Write function and select Visible Items -> Display Style and then select Hex Display.", but this only works when applied to a constant, in indicators it does not give me the Hex Display option, please help me by explaining how I can send that frame in hexadecimal.

 

I've attached some images so you can see the code.

Download All
0 Kudos
Message 9 of 17
(213 Views)

@JavierDavid2006 wrote:

I tried this way "Right click on the "data in" constant or control wired to the TCP Write function and select Visible Items -> Display Style and then select Hex Display.", but this only works when applied to a constant, in indicators it does not give me the Hex Display option, please help me by explaining how I can send that frame in hexadecimal.

 


The pictures don't show an indicator, they show an unbundle by name node.

 

An indicator looks like this on the block diagram:

Kyle97330_1-1753827784782.png

And would look like this on the front panel:

Kyle97330_0-1753827743043.png

On the front panel, you can set "Display style":

Kyle97330_2-1753827835582.png

Kyle97330_3-1753827860386.png

I suspect what you really need to do is to convert ASCII text currently showing hexadecimal bytes into a byte array.  Can you confirm?

0 Kudos
Message 10 of 17
(205 Views)