05-02-2013 09:08 AM
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.
05-03-2013 01:55 AM
I found one solution is insert VISA Flush I/O Buffer after the VISA write like in the picture
05-03-2013 05:50 PM - edited 05-03-2013 05:56 PM
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