From 08:00 PM CDT Friday, August 12 - 01:00 PM CDT Saturday, August 13, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview cannot get serial port response

Solved!
Go to solution

Hi everyone

I have to communicate to a serial port device, and have got it work correctly in Teraterm through COM4 port

Then I have the device displayed correctly in NI-MAX, and I'm be able to send and received through COM4 port as in the sample "Simple Serial.vi"

The problem is, I got the "bytes read" number correctly, but the response itself is empty.

Can anyone have any suggest?

Response is correctly display in TeratermResponse is correctly display in Teraterm

 

I use the Simple Serial sample and enter the same command as in Teraterm, but the response is incorrect, but the bytes read is correctI use the Simple Serial sample and enter the same command as in Teraterm, but the response is incorrect, but the bytes read is correct

0 Kudos
Message 1 of 6
(163 Views)

Hi knakamura,

 


@knakamura wrote:

I have to communicate to a serial port device, and have got it work correctly in Teraterm through COM4 port

Then I have the device displayed correctly in NI-MAX, and I'm be able to send and received through COM4 port as in the sample "Simple Serial.vi"

The problem is, I got the "bytes read" number correctly, but the response itself is empty.

Can anyone have any suggest?


The response string is not empty, there is atleast one char…

 

Switch that string indicator to "\-code" displaymode (or "hex") to see what you received.

Which command do you send to your device? Can you attach the communication manual of that device?

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 2 of 6
(141 Views)

Hi 

Thank you for your reply

I've already turned to "\-code" display mode and send this command line

/\r\n

(The command itself is "/")

I don't have the manual in English, just the Japanese instruction.

But I'm sure that the command is correct, because it runs correctly in Teraterm

0 Kudos
Message 3 of 6
(118 Views)

You didn't send /\r\n but /¥r¥n

 

That's very different. There is no single codepage that would mix up those characters somehow since the \ character is in the lower 127 characters of the ASCII table that all codepages display they same.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 4 of 6
(110 Views)
Solution
Accepted by topic author knakamura

You also get at multi line response from your device. 

You need to read all the lines. VISA read will, as default, stop the reading when it sees a received \n.   

0 Kudos
Message 5 of 6
(106 Views)

Thank you dkfire

 

I managed to read correctly the response.

The solution is repeating the VISA Read command through all the lines of the response.

Thank you very much, this helped me a lot.

0 Kudos
Message 6 of 6
(93 Views)