LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

asynchronous serial message read

Solved!
Go to solution

Hi, everybody.

I have the message based device. I don't know when the device will send the message, so I didn't know how should I create the VISA read function to read whole string from the device(because it reads only data, which are enabled at serial port buffer).May be it can be done by using VISA bytes at port in while loop, but I don't know exactly how.Can you explain it to me?Or do you have any other solution?Thank you for your help.

0 Kudos
Message 1 of 5
(4,691 Views)
Begin with the serial read/write examples in the Example Finder. That will get you started. Then post back if you have specific questions.
0 Kudos
Message 2 of 5
(4,690 Views)
I have allready used write and read examples, but my problem is more different. In these examples I can write data to the serial port and then immediately(or with specific delay after write operation) read them from serial buffer. This delay is good for the case If I want longer message to read immediately. But my problem is that I need only the reading operation of quite long message and I don't know exactly in which time the device will send its output message. So I think, that I have to make some kind of waiting loop and tested the serial charater event.Do you have any examples of this?
0 Kudos
Message 3 of 5
(4,668 Views)
Solution
Accepted by topic author pigmeo

Hi

I reworked the basic serial read and write example, just to give you some programming hint. Also remember that then reading from the serial buffer, you do not need to read all the content. Read the number of bytes you need. The serial buffer is FIFO type. So the oldest content will always be first in the queue to read

My example is somewhat simple, and I did not test it but should work. Check out queues and notifiers (in example finderfor more advanced programming techniques.

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 5
(4,650 Views)
You are my hero, that is what I needed. At more I have the message with variable length, but I solve it by another condition and with adding delay before read.Thank you so much.:smileyhappy:
0 Kudos
Message 5 of 5
(4,646 Views)