RS-232 Operation Using Quick BASIC
The following example shows how to send command instruction and receive data responses over the
The program example is set up on "COM1".
CLS
E$ = "A"
ST1:
CLOSE #1
OPEN "COM1:1200,E,7,1,DS,RS" FOR OUTPUT AS #1
PRINT #1, E$;
CLOSE #1
OPEN "COM1:1200,E,7,1,DS,RS" FOR RANDOM AS #1
ST2:
INPUT #1, A$
B$ = MID$(A$, 2, 6)
DEC = 0
F$ = "0123456789ABCDEF"
N = 6
FOR I = 0 TO 5
C$ = MID$(B$, N, 1)
N = N - 1
D = INSTR(F$, C$) - 1
DEC = DEC + (16 ^ I) * D
NEXT
DEC = DEC / 1000
C$ = MID$(A$, 1, 1)
10