LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic serial write and read example charcter formats?

Hi!

 

I am trying to communicate with device through serial using labview. I have already communicate with that device in terminal so i know it does works and i know what characters do i have to sent.

 

I tried Labview basic serial write and read examble, but i can't get read data.  Think i sent characters in wrong format ?... Lets assume that characters what i have to sent is: 0A 0A

 

I put those to "string to write box" and labview changed those format 0A\s0A -> run, doesnt work. If I changed dispay to HEX and wrote 000A 000A that dont worked eather. HEX characters worked on terminal. Bound rate and others are correct. Also tried to sent characters in dec-format too.

 

Debugging in labview tells that everything is OK. So it must be in characters. 

 

Eny ideas? 

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

What is the device expecting? Is it expecting a series of hex values like 0A, or is it expecting human-readable strings?

 

The Basic Serial Write and Read example VI has the string control set to '\' codes display mode. This means that characters such as linefeed, carriage returns, and tabs are displayed using \ codes. If you enter the characters "0A 0A" you will be sending out the character zero, the character A, the character space, the character zero, and finally the character A. If the instrument is expecting hex values then this will not work. 

 

If you change the display mode to  "Hex Display" then you should only be typing 0A0A. In other words press zero on the keyboard, press A, press 0, then press A. That will give you "0A0A" in the display.

0 Kudos
Message 2 of 4
(3,169 Views)
x

smercurio_fc wrote:

What is the device expecting? Is it expecting a series of hex values like 0A, or is it expecting human-readable strings?

 

The Basic Serial Write and Read example VI has the string control set to '\' codes display mode. This means that characters such as linefeed, carriage returns, and tabs are displayed using \ codes. If you enter the characters "0A 0A" you will be sending out the character zero, the character A, the character space, the character zero, and finally the character A. If the instrument is expecting hex values then this will not work. 

 

If you change the display mode to  "Hex Display" then you should only be typing 0A0A. In other words press zero on the keyboard, press A, press 0, then press A. That will give you "0A0A" in the display.


x2

 

Change your string controls/constants to '\ codes display' mode.

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

That works fine. I can now send HEX string to device and it gives back response. Thank You for answers!

 

I get now data from device. Data looks like this in string display: fÚñ¿‡ò¶¾ëü@  BUT, when changing display to HEX, it is correct. Now i have a problem how to change HEX data to numbers. How i can handle and change data which is in this format fÚñ¿‡ò¶¾ëü@  Data is HEX only in string displays.

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