AnsweredAssumed Answered

RS232 Buffer?

Question asked by ChemEnger on Feb 13, 2007
Latest reply on Feb 13, 2007 by odanzy
I am using Agilent VEE Pro 7.1 as part of a test & measurement routine.

The majority of signals for the system are analog and digital inputs from a data acquisition card (PCI) installed in the PC.

However, I have recently added a floor balance (weighing scale) to the system.

The balance uses an RS232 connection to send mass information to the computer, but is a VERY simple two wire connection, with instrument send and ground connections only.  This means that there is no receive on the instrument and I am therefore restricted to one way communication only.

I have set the instrument up in the I/O configuration menu of VEE and have placed a Direct I/O object in my program which successfully reads the instrument.

My problem is that reading the serial port slows my program down significantly due to the baud rate of the serial port compared to the PCI card.

My solution to this was to only read the serial port every 250 cycles of the PCI card, but this creates a large lag in the data being received.  My assumption at the moment is that the serial buffer is filling with information, as the balance is sending a constant signal and I am picking up only every 250th send - e.g. PCI cycle 251 = output 2 of the serial link.  I have tried reducing the buffer size to 32 bits / bytes (?) within the serial I/O configuration, but this has not remedied the problem.

Could anybody please suggest a solution to clear the serial buffer each time I want to take a reading so that I am getting the latest data only? (If this is the solution).  I have Visual Basic 2003 available and am prepared to create a stand-alone executable to be called if required, but would prefer to do the programming 100% within VEE if possible.

All help appreciated.  Apologies for the long post, but I thought it worthwhile to explain the problem and my attempted remedies so far.