LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to detect data received in com port?

Solved!
Go to solution

I have used NI VISA read function to read and i tried to write and read the same data by loop back. i could read from the port , but i need to read only when any data comes in the serial port.how i will detect any data received in the com port?Based on the data received only i need to write the data to port.

pls help me

0 Kudos
Message 1 of 8
(3,168 Views)

There are several ways of doing this.
If I understood your correctly, a simple solution is to create a property node, select the "Instr" (inside VISA) and use "Number of Bytes at Port". Then you check the number of bytes you expect and create a condition.

If this is not what you are looking, then I'm sorry but that's what I understood.

 

Regards

Mondoni
0 Kudos
Message 2 of 8
(3,167 Views)

You can use the Bytes At Port property node.  Personally, I just use the VISA Read with the number of bytes I am expecting and let the VISA timeout determine my loop rate.


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 3 of 8
(3,162 Views)

Hi,

 

I have tried the "bytes at port property node" and created a condition to check whether it receive the no of bytes i expecting . but it reads only less bytes than it shown on "bytes at port property node".

0 Kudos
Message 4 of 8
(3,112 Views)

Can you post your VI ?

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 8
(3,108 Views)

I need to read 15 bytes data received in com port. Please check below vi and suggest me to read 15 bytes of data from com port continuously. it shows framing error when i run the vi.

 

 

0 Kudos
Message 6 of 8
(3,099 Views)
Solution
Accepted by topic author neethukk

This should work better...just set your own port number, I used COM 20.

 

 





0 Kudos
Message 7 of 8
(3,091 Views)

give a condition dat its should only read the data when no of bytes at port is > or = to 15 and put the read part in a case structure,It will work.

0 Kudos
Message 8 of 8
(3,084 Views)