Kbase P7078: How to read data from a serial COM port
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/1/2008 |
|
Status: Verified
GOAL:
How to read data from a serial COM port?
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
FIX:
The following sample code reads check numbers from COM1 serial port:
DEFINE VARIABLE iCheckNumber AS INTEGER NO-UNDO.
DEFINE VARIABLE cCheckString AS CHARACTER NO-UNDO.
DEFINE STREAM StreamName.
INPUT STREAM StreamName FROM value("COM1").
ASSIGN
cCheckString = "".
REPEAT:
READKEY STREAM StreamName PAUSE 0.
IF LASTKEY = -1 THEN
LEAVE.
ELSE
ASSIGN
cCheckString = cCheckString + CHR(LASTKEY).
END.
INPUT STREAM StreamName CLOSE.
iCheckNumber = INTEGER(cCheckString).