Sequential File Processing Example


EXAMPLE 1

** This program  will query the Hayes compatible modem attached to
* COM1: and display the contents of it's registers.  It illustrates
* the use of the commands:  OPENSER, GET, and SEND
*
EQU timeout   TO 1        ;* How long to wait for a response from modem
EQU termchars TO CHAR(10) ;* End input when RETURN received
*
* Open the serial port
OPENSER "COM1:" TO fid ELSE ABORT 201,"COM1:"
*
* Ask the modem for it's current configuration
SEND "AT&V" TO fid ELSE CRT "*Unable to send data to modem?"; STOP
*
* Keep reading until we don't get any more data
LOOP
   GET input SETTING count FROM fid UNTIL termchars WAITING timeout THEN
      * Got a line of text from the modem - print it
      CRT input
   END ELSE
      * Either a timeout or the end of data; for this example, assume we're done
      CRT
   END
UNTIL (input = '') DO
REPEAT
*
* Cleanup
CLOSE fid
END

 


jBC