Author Topic: serial buffer  (Read 5902 times)

tipster

  • Newbie
  • Posts: 7
    • View Profile
serial buffer
« on: August 08, 2005, 07:58:43 AM »
Is it possible, through some undocumented command/procedure to clear the serial buffer and/or test the buffer for content, prior to issuing the INPUT$ command ?
     It has been my experience that until an INPUT$ command is issued,it is possible for multiple <CR> terminated strings to reside in the buffer. I have a program where I am trying to read a string at a specific instance in the program, if I were to make multiple scans prior to reading the contents, then I am reading the first scan to enter the buffer, the next command reads the next string and so on.
Any help would be greatly appreciated














support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:serial buffer
« Reply #1 on: August 12, 2005, 01:15:06 PM »
You can issue a loop command to read the serial buffer until there is no more characters, as follow:

   FOR I = 1 TO 256
       IF INCOMM(1) < 0 GOTO @10
    NEXT

@10  ..... ' incoming Serial buffer for comm 1 cleared.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS