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: 

Serial read issue

Solved!
Go to solution

Hi, I'm trying to read data on RS422, but having issue with the reception.

The DUT sends 36bytes every 2ms and i'm trying to receive this data inside labview. the complete bunch (of 36 bytes) is sent in approx 800 microseconds.

when I'm using serial read inside while loop, the received data bytes are randomly shifted.

when i read 100 or more bunches at a time (without using while loop), then everything is received ok.

What could be the issue. Please suggest solutions.

regards,

0 Kudos
Message 1 of 17
(2,440 Views)

Sound like it could be a misconfiguration of the serial port. Wrong Nr. of stop bits, or parity bit maybe?

Message 2 of 17
(2,427 Views)

Hi jpparmar,

 

probably there is a problem in your code.

As you didn't attach your code/VI you need to debug it on your own

Best regards,
GerdW


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

The configuration seems to be ok i.e., data bits=8, start bit= stop bit =1, parity =nil.

Also, if the config is not ok, then the version with no while loop will also not work.

0 Kudos
Message 4 of 17
(2,400 Views)

The block diagram is attached.

0 Kudos
Message 5 of 17
(2,398 Views)
Solution
Accepted by topic author jpparmar

Hi jpparmar,

 

are you reading "binary" data from your device - or formatted ASCII?

Mabye the TermChar crushes your messages!?

 

Notes:

  • Read the help for the VISASerialConfig function. The full help on all its inputs…
  • The way you read messages need to fit to the message content. Unfortunately you don't provide any information on the message format nor the device sending them…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 17
(2,390 Views)

bd3 works fine. it receives 100 bytes and stops.

while bd1 works but byte locations are shifted.

Download All
0 Kudos
Message 7 of 17
(2,388 Views)

Hi jp,

 

bd3 works fine. it receives 100 bytes and stops.

It is working "fine" with receiving just 100 bytes even though you are requesting for 3600 bytes???

Best regards,
GerdW


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

@jpparmar wrote:

The configuration seems to be ok i.e., data bits=8, start bit= stop bit =1, parity =nil.

Also, if the config is not ok, then the version with no while loop will also not work.


Not per se.

 

If handshaking is done after a message, what is consisting a message will make a difference. I'm not sure if it can actually happen, but I wouldn't rule out the configuration.

 

If you are communicating binary data, the configuration of termination characters is definitely wrong.

0 Kudos
Message 9 of 17
(2,367 Views)

@

The data is binary.

I made a mistake. I am receiving 3600 bytes not 100. The version without while loop is working fine as required.

0 Kudos
Message 10 of 17
(2,347 Views)