LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 receive not working for 67 bytes?

Solved!
Go to solution

I have a built a simple Send and Recieve VI that implements RS232.  I have an issue where I am sending a command, waiting 2.5 seconds (I have tried many different wait times, not sure if it matters here, I just like it in there for my piece of mind), I have a property node after the wait that is telling me the # of bytes at the port, then I read the buffer. 

 

What is happening is I am not getting anything besides a carriage return in my read buffer output.  My property node is telling me that I have 67 bytes in the buffer, but it is not displaying the 67 bytes in the read buffer display.

 

I will try and step by step my code here, because I am not overly sure how to post a VI on these forums.

1.) I configure my com port, 9600 baud, 8 data bits, 1 stop bit, no parity bits, no flow control.

2.) Flush I/O buffer, 16 mask

3.) Write my command

4.) Write a carriage return

5.) time delay of 2.5 seconds

6.) Property Node, serial settings: Number of Bytes at Serial Port

7.) read buffer

8.) close

 

Real simple and works on other commands, the other commands do not reach the size of 67 bytes though and the highest I have seen this work with is 24 bytes.

 

I just find this odd that it tells me the number of bytes at the port yet all my VI reads is the carriage return.

 

Any ideas

 

Thanks,

 

Bill

 

To Administrators:  I apologize if I am in the wrong forum, feel free to move if I am.

John 3:16
0 Kudos
Message 1 of 5
(3,229 Views)

The forum is fine.  To attach your VI, use the Add attachments link that is located below the edit window. Which browser are you using?  There is a bug with attaching files with 2 letter extension in the filename when using Safari or Chrome, so I'd recommend going to a more standard browser such as IE or Mozilla.

 

What kind of device are you trying to communicate with?  Do you have a link to its manual?

 

 

Message 2 of 5
(3,227 Views)
Solution
Accepted by topic author ggoatman
One thing you need to be aware of is that the default behavior of the VISA Read is that it will terminate it's read as soon as a LF (0xA) is detected. This is the 'Enable Termination Character' input of the VISA Configure Serial Port function. With this enabled, it does not matter how many bytes you request. If there is a LF at the beginning of the data, then you should set the 'Enable' to false.
Message 3 of 5
(3,222 Views)

Here's my code, real simple, I am using COM 1 and COM 3 on the board I am using, but for this issue I am seeing I am seeing it on COM3 (If that makes a difference)

 

I am using IE on this comp

 

The device I am trying to communicate with is a power board for a medical application.  I can not hand out the whole PDF, but if there is a more specific question I may be able to dig it up (it is a roundabout way, and I apologize, I just am not able to give the whole PDF)

 

I should have also stated that using hyperterminal I can see exactly what I want to see, is there some information that could be construed as an termination character?  I wouldnt think so, but I am a novice.

John 3:16
0 Kudos
Message 4 of 5
(3,219 Views)

Dennis,

 

You were correct, I had this funny feeling I was doing something fundamentaly wrong; I put the enable termination character to false and by golly there's my data 🙂

 

Thanks for the help guys,

 

Bill

John 3:16
0 Kudos
Message 5 of 5
(3,214 Views)