Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Buffer Size of Serial Port Increase each time ???

Hello,

 

I create a programe to control a motor. I want to send an string to move the motor. But each time I send that string, the buffer size of serial port increase. It make slowdown the reading that string or something...

Here I upload  my .vi. You could run it if connect Rx and Tx of RS232.

0 Kudos
Message 1 of 3
(3,430 Views)

I found one solution is insert VISA Flush I/O Buffer after the VISA write like in the picture

 

2013-05-03_155224.jpg

0 Kudos
Message 2 of 3
(3,415 Views)

What makes you think your buffer size is increasing? 

 

I have never needed to use VISA Clear or Flush buffer.  Perhaps if your instrument is poorly behaved, they might be needed, but doing it after every write is likely a symptom of some other problem.

 

What termination character does your instrument need? Using the EOL constant will produce different results on different computer platforms.  When dealing with serial communications systems, it is much safer to explicitly enter the actual constants needed.

 

When you hit the stop button, you get one more attempt to read the serial port but there will not be any data there to read so you wait for the timeout (default = 10 seconds) which seems like a long time when waiting for the program to stop.

 

Also, younever close the serial port.  Wire a VISA Close after the while loop. This will release the port so that it can be used by other programs.

 

Lynn

0 Kudos
Message 3 of 3
(3,401 Views)