LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Port Overflow

Solved!
Go to solution

I have a piece of hardware I am controlling using both a GUI and knobs/dials/buttons on the instrument itself.

 

Every time I change something manually, the instrument generates data and sends it to the port. I have no interest in every collecting this data.

 

When I want to write something to the port, prior to calling VISA write.vi, I use the attached subVI to flush the data at the port.

 

If I have done too much manually since my last VISA write command, the VISA read command in the attached subVI throws an overflow error (-107380252), which I am assuming means there are more than 4096 bytes (buffer size set at port initialization) at the port.

 

Am I right about that?

 

Is there a better way to flush the port that won't complain if there is too much at the port?

 

Do I need to just flush the port every so often so that it can't get too full (I would really prefer NOT to have to do this because it seems like it would add a bunch of overhead)?

 

 

 

0 Kudos
Message 1 of 5
(3,442 Views)

Can you pls post the code in 8.6,

 

Check this option , initialize your VISA, use bytes at port and wire it to VISA read this will read all the pending data in buffer, you can flush the buffer now and then write the command using VISA write . Try this.

0 Kudos
Message 2 of 5
(3,437 Views)

 


@systemcrash wrote:

Can you pls post the code in 8.6,

 

Check this option , initialize your VISA, use bytes at port and wire it to VISA read this will read all the pending data in buffer, you can flush the buffer now and then write the command using VISA write . Try this.


This is essentially what the posted subVI does, and I get the overflow error if there are more bytes at the port than the buffer size.

 

8.6 version attached

0 Kudos
Message 3 of 5
(3,434 Views)

 Check this

 

According to this you are safe.

0 Kudos
Message 4 of 5
(3,428 Views)
Solution
Accepted by topic author Munson1027

If there is too much data waiting at the instrument port, the READ in the attached subVI throws an overflow error.

 

I replaced this entire subVI with VISA Clear.

 

Works great.

 

Matt

0 Kudos
Message 5 of 5
(3,411 Views)