cancel
Showing results for 
Search instead for 
Did you mean: 

Data at Serial Port

shrekt
Active Participant

Data at Serial Port

 Hi all,

 

First let me explain setup :

 

I am communicating between 2 PCs through RS 232.

now my ques is :

 

I want to implement like, if the serial port gets the data then only read and only those many bytes which are on the seial port,

 

Now i am doing it, as read the serial port but if data is not there then timeout error comes.

 

 

If anyone can share some thought on it.

 

Regards,

 

Shrekt

5 REPLIES 5
Andy.G
NI Employee (retired)

Re: Data at Serial Port

Hey Shrekt,

 

Im a little bit confused on exactly what you are trying to do, could you attach a print screen of your code maybe?

Regards

Andrew George @ NI UK
shrekt
Active Participant

Re: Data at Serial Port

I mean I want to read the port only when there is some data on the it, until then wait and check if data is there.

 

Regards,

 

Shrek

Dennis_Knutson
Knight of NI

Re: Data at Serial Port

Simply use the VISA Bytes at Serial Port.

Highlighted
Andy.G
NI Employee (retired)

Re: Data at Serial Port

Message contains a hyperlink

Hey Shrekt,

 

For what I can tell there is no particularly easy way to do this. I have found a relevant post one of my colleagues has created which might just be useful to you and help you on your way a little. The link is posted below, you may need to copy and paste it into your browser address bar. Failing that you can always go onto the ni website (ni.com) -> developer zone -> examples -> in search bar type "message bus" and it should be the first result.

 

http://decibel.ni.com/content/docs/DOC-12159

 

Hope this helps!

Regards

Andrew George @ NI UK
Dennis_Knutson
Knight of NI

Re: Data at Serial Port

Andrew,

 

I don't see the relevance or the difficulty. The function I mentioned is used in the shipping examples and in in hundreds of other posted serial examples.