LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send HEX data by LabView TCP Socket

Hi Javier,

 


@JavierDavid2006 wrote:

I need to send the frame string "Trama_Elip.T_Definitiva_ELIP" in hexadecimal format 


How much LabVIEW experience do you have?

Do you know about clusters and their elements?

How does your "hexadecimal format" look like? (Which kind of chars, how many bytes, and so on…)

 


@JavierDavid2006 wrote:

I am attaching an example of the frame:

 

4C410000203030303229317CAA05A09900000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000030000000000000 ).


Does your "ELIP" string contain just readable ASCII chars (including space, closing bracket and dot at the end)?

Or does that "string" represent a byte array, made of some ASCII chars (0x4C, 0x41 = "CA"), and lots of zero bytes?

 

Attaching images of code is senseless: we cannot edit/debug/run images with LabVIEW!

When you want to discuss code issues then you need to attach (real) code!

Best regards,
GerdW


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

Hello everyone,

 

I'm attaching the code I have, but I don't know how to convert it to ASCII.

 

Regarding the frame length and the reason for so many zeros, it should be 80 bytes. I'm attaching a technical image explaining this.


This frame appears correctly in hexadecimal, but I don't know how to convert it to ASCII so I can send it.

Download All
0 Kudos
Message 12 of 17
(309 Views)

Hello,

 

I have converted the characters to ASCII but there are some values that I consider are not printable, for example 00, I don't know how to send them from Labview so that they are received as 00 on the server that I am managing.

 

Thanks you very much.

0 Kudos
Message 13 of 17
(294 Views)

Hi Javier,

 

thanks for attaching the code - but "TCP handler.vi" is missing…

 

(Please use ZIP instead of proprietary RAR archive.)

Best regards,
GerdW


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

I've attached it below.

 

Thank you very much.

0 Kudos
Message 15 of 17
(278 Views)

The TCP Handler VI is in the SubVI folder.

0 Kudos
Message 16 of 17
(279 Views)

The display style is only that: the display style. It does not change the underlying data.

 

You have to construct the data in Trama_Elip.T_Definitiva_ELIP in a proper way. 

 

In "Trama_Cabecera", you can change the display style of the header constants and see they are not what they should be. 

cordm_1-1754035663531.png

 

Then, in "Union_Tramas_Elip" you build the rest of the packet, using the previously constructed string from "Elip_Pisos" . Same as before.

cordm_3-1754037951513.png

 

I'm not going to look too closely at Sub_VIs_Arreglo_Pisos.vi., but again, change the display type of your constants.

If you need a bunch of literal zeros in a string, use this:

snip_zero_pad_string.png

 

0 Kudos
Message 17 of 17
(251 Views)