Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I quickly periodically scan the rs232? (like reading the serial mouse movements)

I need to repeatedly read data from serial mouse (which is modified for special movement sensing). I wrote a separate vi vith a loop and visa read for scanning the port, which works on separate thread. But it's too slow. I can't catch some data the mouse sends. I also put the wait function into the read loop to let the os freely switch between tasks (the processor use is then max about 50%, instead 100% as before). Does anybody know some solution? An exemplary vi were nice 🙂 Thanks
0 Kudos
Message 1 of 3
(3,394 Views)
If you are missing bytes, you are probably overflowing your buffer. Are you reading in a fixed number of bytes each time? If so, you should change you code so you read the whole buffer. Instead of just doing a read, do a "Visa Bytes at Serial Port" then wire the return value to the "Visa Read" so you read in that exact number of bytes.
Ray K
NI Applications Engineer
0 Kudos
Message 2 of 3
(3,394 Views)
If you are missing bytes, you are probably overflowing your buffer. Are you reading in a fixed number of bytes each time? If so, you should change you code so you read the whole buffer. Instead of just doing a read, do a "Visa Bytes at Serial Port" then wire the return value to the "Visa Read" so you read in that exact number of bytes.
Ray K
NI Applications Engineer
0 Kudos
Message 3 of 3
(3,394 Views)