DIM intPortID AS INTEGER
DIM lngStatus AS LONG
DIM strError AS STRING
DIM strData AS STRING
lngStatus = CommOpen(intPortID, "COM" & CStr(intPortID), _
"baud=9600 parity=N data=8 stop=1")
IF lngStatus <> 0 THEN
lngStatus = CommGetError(strError)
MsgBox "COM Error: " & strError
END IF
lngStatus = CommSetLine(intPortID, LINE_RTS, True)
lngStatus = CommSetLine(intPortID, LINE_DTR, True)
lngSize = LEN(strData)
lngStatus = CommWrite(intPortID, strData)
IF lngStatus <> lngSize THEN
END IF
lngStatus = CommRead(intPortID, strData, 64)
IF lngStatus > 0 THEN
ELSEIF lngStatus < 0 THEN
END IF
lngStatus = CommSetLine(intPortID, LINE_RTS, False)
lngStatus = CommSetLine(intPortID, LINE_DTR, False)
CALL CommClose(intPortID)
|