LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Various message length in serial port communication

OK, new VI posted in attachment.

0 Kudos
Message 21 of 28
(987 Views)

The first thing that I notice is that you might have a race condition.  Are you sending any of the button commands when the "error" happens?  Maybe the device is sending a reply or ACK as well.  I would put the button commands into an event structure and the CMD + Read section into the timeout event.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 22 of 28
(977 Views)

Thank you.

 

crossrulz has a good point.  It might be better to have just one Write and feed the command strings to that Write depending on which button is pressed.

 

Do you see variations in the Number of Bytes at Serial Port when these errors occur?

 

Is the instrument doing anything different at the times the errors occur?

 

Have you detected any patterns, such as every tenth Read, when the errors occur?

 

Lynn

0 Kudos
Message 23 of 28
(969 Views)

When I send button commands I don't care what I get in return. The problem exist for me only when I don't operate with buttons.

 


Have you detected any patterns, such as every tenth Read, when the errors occur?

Yes, now the problem exist with every second read.


0 Kudos
Message 24 of 28
(959 Views)

I am beginning to think the problem is either something the remote device is sending or that there is something in the communications protocol which you are missing.  At this point, I do not have any ideas how to determine where the problem is.

 

Lynn

0 Kudos
Message 25 of 28
(952 Views)

Well.... This is what I thought at the beginning. The problem is that a producer says that the documentation is OK (but I proved that has some errors) and that the communication is standard and simple. At this point I am thinking how to use this two cases that I have now - the good and bad one.

 

I will probably check the string length and then if it is not correct cut the additional bytes to read the only proper bytes. This is the only idea I have for this problem at the moment. 

0 Kudos
Message 26 of 28
(949 Views)

There is no such thing as "Standard" when it comes to RS-232 communications.  The only things which are standardized are the voltages and the byte framing.  The values of the bytes transmitted are absolutely, completely up to the choices made by the person designing the system.

 

The biggest problem I see with using the string length is that you do not know which byte or bytes are the wrong ones.  In the small amount of erroneous data you have posted, it appears that the extra bytes are usually 00.  However some valid bytes are also 00, so you cannot just remove them.

 

Do you have any way of validating the data to be sure that you removed the appropriate bytes?

 

Lynn

0 Kudos
Message 27 of 28
(944 Views)

I don't have this device available right now, but i remember that there is an additional 3-bytes long string before the proper message. Thus I can distinguish whether I have a proper or wrong string. Monday I will try it and let you know what the result is. 

0 Kudos
Message 28 of 28
(933 Views)