06-15-2004, 01:57 AM
I am trying to interface a PC with a balance using QBasic but I cannot make that the PC can communicate with the balance. I use the following coding:
OPEN "com1:2400,e,7,1,cs,cd,ds,rs,lf" FOR RANDOM AS #1
crlf$ = CHR$(13) + CHR$(10)
in$ = "SI"
gpos = 0
DO UNTIL ((gpos > 0) OR (done = 1))
LOOP
PRINT #1, in$; crlf$
DO WHILE LOC(1) > 0
weight$ = INPUT$(LOC(1), #1)
gpos = INSTR(1, weight$, "g")
CALL DELAY(1, done)
LOOP
PRINT weight$
IF gpos > 0 THEN
PRINT ""
PRINT "Communications verified."
PRINT ""
ELSE PRINT "Communications have not been verified."
END IF
PRINT "Press <space> to start, or q to quit."
go$ = "g"
DO UNTIL ((go$ = " ") OR (go$ = "q"))
go$ = INKEY$
LOOP
Can any one help me on this?
Thank you!!!
Gonzale0
OPEN "com1:2400,e,7,1,cs,cd,ds,rs,lf" FOR RANDOM AS #1
crlf$ = CHR$(13) + CHR$(10)
in$ = "SI"
gpos = 0
DO UNTIL ((gpos > 0) OR (done = 1))
LOOP
PRINT #1, in$; crlf$
DO WHILE LOC(1) > 0
weight$ = INPUT$(LOC(1), #1)
gpos = INSTR(1, weight$, "g")
CALL DELAY(1, done)
LOOP
PRINT weight$
IF gpos > 0 THEN
PRINT ""
PRINT "Communications verified."
PRINT ""
ELSE PRINT "Communications have not been verified."
END IF
PRINT "Press <space> to start, or q to quit."
go$ = "g"
DO UNTIL ((go$ = " ") OR (go$ = "q"))
go$ = INKEY$
LOOP
Can any one help me on this?
Thank you!!!
Gonzale0