AnsweredAssumed Answered

VRF - flush the com port buffer on PC?

Question asked by VRFuser on Mar 27, 1996

from:   Dave Lukert                email: dave@wren.geg.mot.com
        Motorola, Inc. GSTG        Scottsdale, AZ
to:     Steinar Rafaelsen

>      Hi all visual engineers!
>     
>      I am using direct IO through the serial port on a PC w/VEE 3.12. I am
>      having problems communicating, seemingly due to the com port buffer
>      filling up. Does anyone know how to flush it, using HP VEE objects?
>      Do I need to write a "DLL"?
>     
>      Thanks
>     
>      Steinar Rafaelsen
>      Nera Telecommunications
>      Caspersens veg
>      N-4950 Risor
>      Norway
>     
>      voice: (+47) 37 15 39 00
>      fax:   (+47) 37 15 09 60
>      e-mail: sra@nera.no   

I don't believe "an EXECUTE RESET transaction" will help and I don't
think you need to write a DLL.

I had an application in which I didn't know if I was going to get data back
on the serial port or how much data to expect (if any).  So after every
string I wrote to the serial device, I needed to read whatever came back
from the device.

If this is your problem, and assuming that you are not overloading the
transmit buffer, this should allow you to get any or all the data in the
receive buffer (flush it).

- Set the serial Device Configuration Timeout to about 3 seconds
      or however long you want to wait for it.
- For the READ I/O Transaction, use READ TEXT x STR MAXFW:70
      or whatever your maximum possible string length is.

The Timeout Error will occur if there is no data coming back, or after
all the data has all been read. The Break traps the error.

For my device, I also had to set the Direct I/O Configuration Write EOL
Sequence to "
", instead of just "
", i.e. <CR><LF> instead of just <LF>.
I believe this is a DOS versus UNIX thing.
    

  +-------------------------+
  |SerialDevice(@9)         |
  +-------------------------+
  |WRITE TEXT a STR EOL     |
  +-------------------------+
  |                         |
  +--------+----------------+
           |
           |
   +-------+------+
   | Until Break  |---+
   +--------------+   |
                      |
       +--------------+---------+-------+
       |SerialDevice(@9)        |       |
       +------------------------+       |
       |READ TEXT x STR MAXFW:70|       |
       +------------------------+       |
       |                        +-------+     +--------------------+
       |                        |  X    |---->|Logging Alphanumeric|
       |                        +-------+     +--------------------+
       |                        | Error |---+
       +------------------------+-------+   |
                                            |
                                        +---+----+
                                        | Break  |
                                        +--------+

----------------------------------------------------------------------


Outcomes