[Migrated content. Thread originally posted on 01 August 2005]
Urgent...Can anyone send me an example of coding a com-port. I want to be able to catch the weight of a weigh scale.
For the moment, I'm testing with a scanner but that must be the same I guess.
If I send data from the scanner to the com-port, I notice there is data to be received, but I'm stuck in what to do for reading that data.
*
OPEN-COMPOORT-Clicked.
PERFORM OPEN-POORT00 THRU OPEN-POORT99.
OPEN-POORT00.
MODIFY MSCOM, @RThreshold = 1.
MODIFY MSCOM, @InputLen = 1.
INITIALIZE SA-STRING.
STRING WBAUDRATE DELIMITED BY SPACES
"," DELIMITED BY SIZE
"N" DELIMITED BY SIZE
"," DELIMITED BY SIZE
"8" DELIMITED BY SIZE
"," DELIMITED BY SIZE
"1" DELIMITED BY SIZE
INTO SA-STRING
END-STRING.
INSPECT SA-STRING REPLACING TRAILING SPACES BY LOW-VALUES.
MODIFY MSCOM, @Settings = SA-STRING.
MODIFY MSCOM, @CommPort = COMPOORT-IDX.
MODIFY MSCOM, @PortOpen = "True".
OPEN-POORT99.
*
*
MSCOM-Ev-OnComm.
PERFORM RECEIVE00 THRU RECEIVE99.
RECEIVE00.
DISPLAY MESSAGE BOX "Trying to receive data - one moment..."
INQUIRE MSCOM, @InBufferCount IN WCHAR-IN-BUFFER.
DISPLAY CHAR-IN-BUFFER-EF.
INQUIRE MSCOM, @Input IN HANDLE-OF-INPUT-STRING.
CALL "C$GETVARIANT" USING HANDLE-OF-INPUT-STRING,
INPUT-STRING.
DISPLAY INPUT-EF.
RECEIVE99.
*



