From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo 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: 

an error about reading serial port

Hi,
  I have sent 5 bytes(for example: "0","2","F","1","/n") to serial port and used VISA Read. But I only can read 0.  The right result is in the second line of the read string window, The first line is void. Generally speaking, "02F1" should in the first line,then I can read them correctly. The following picture is the result.
  Thank you!
   

帖子被hengfo在09-17-2007 03:57 AM时编辑过了

0 Kudos
Message 1 of 6
(2,934 Views)
Hi hengfo,
 
Are you try to doing a com port loopback test?? Can you send your vi if any for better understanding of your problem.
 
regards,
Simon
0 Kudos
Message 2 of 6
(2,919 Views)

Hello,

you should add a flat sequence with some extra e.g. 50ms delays between the visa writes and reads, that helped us a lot.

You should also specify a large enough buffer. And don't forget to send the terminating CR and LF.

0 Kudos
Message 3 of 6
(2,911 Views)
Thank you! I delay 100ms and the problem has been solved. But what is CR and LF?
0 Kudos
Message 4 of 6
(2,890 Views)

Hello,

the CR and LF are in the string constants section. CR is the "Carriage Return" (arrow down and left) and the LF is the "Line Feed" (arrow down).

0 Kudos
Message 5 of 6
(2,882 Views)
I see. Thank you very much!
0 Kudos
Message 6 of 6
(2,868 Views)