Consultor Eletrônico



Kbase P9569: 4GL/ABL: INPUT FROM COM1 returning wrong values.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   09/02/2010
Status: Verified

SYMPTOM(s):

4GL/ABL: INPUT FROM COM1 returning wrong values.

Connecting to a Fairbanks Ultegra Scale to COM1 serial port using 9600 baud 7 bit odd with 2 stop bits settings.

Wrong results when captured through Progress 4GL.

Using code similar to:

DEFINE STREAM sScale.
DEFINE VARIABLE cString AS CHARACTER NO-UNDO.
INPUT STREAM sScale FROM VALUE("COM1").
REPEAT:
READKEY STREAM sScale PAUSE 0.
IF LASTKEY = 10 OR LASTKEY = 13 OR LASTKEY = 4 OR LASTKEY = -1 OR LASTKEY = -2 THEN
LEAVE.
ELSE
ASSIGN
cString = cString + CHR(LASTKEY).
END.
INPUT STREAM sScale CLOSE.

FACT(s) (Environment):

Correct results are returned when captured through Windows HyperTerminal.
Progress 9.x
OpenEdge 10.x
Windows

CAUSE:

It appears that setting the parity, bit, and stop bits can not be done reliably through 4GL across the various windows operating systems as these OS have different commands and syntax to do that.

FIX:

Use a third party ActiveX control to set the port speed, parity and other needed settings to communicate with the application device.