qbasic Com prog Question 
Author Message
 qbasic Com prog Question

I  have a two partquestion on the following code, if anyone can answer
any part of it, I would be grateful. The first question is can someone
explain to me line by line what it means and how it works. Second can
someone translate it to Visual Basic 3.0?

CLS

OPEN "COM2:1200,N,8,1" FOR RANDOM AS #1

DO
KEY$=INKEY$
OUT$="S"
GOSUB TRANSMIT
GOSUB RECEIVE
LOCATE 5,  1
PRINT A%, B%, C%, D%, E%, F%, G%, H%
LOOP UNTIL KEY$=CHR$(27)
CLOSE #1
END

RECEIVE:
IF INPUT$(2, #1) = "AA" THEN
 INPUT #1,A% ,B%, C%, D%, E%, F%, G%, H%
ELSE LINE INPUT #1 DISCARD$
END IF
RETURN

TRANSMIT:
OUT$="AA"+OUT$
PRINT #1,OUT$
LINE INPUT #1, DISCARD$
RETURN

Thanks




Tue, 27 Jun 2000 03:00:00 GMT  
 qbasic Com prog Question

: I  have a two partquestion on the following code, if anyone can answer
: any part of it, I would be grateful. The first question is can someone
: explain to me line by line what it means and how it works. Second can
: someone translate it to Visual Basic 3.0?
It doesnt look like a full program.. more like a testing tool

: CLS

: OPEN "COM2:1200,N,8,1" FOR RANDOM AS #1
open communications port -usualy modem-

: DO
: KEY$=INKEY$
read keyboard

: OUT$="S"
: GOSUB TRANSMIT
transmit a string ("AAS")
: GOSUB RECEIVE
recieve any string beginning with "AA"
: LOCATE 5,  1
: PRINT A%, B%, C%, D%, E%, F%, G%, H%
Print data recieved
: LOOP UNTIL KEY$=CHR$(27)
until esc(CHR$(27)) is pressed
: CLOSE #1
close com port
: END

: RECEIVE:
: IF INPUT$(2, #1) = "AA" THEN
:  INPUT #1,A% ,B%, C%, D%, E%, F%, G%, H%
: ELSE LINE INPUT #1 DISCARD$
: END IF
: RETURN

: TRANSMIT:
: OUT$="AA"+OUT$
: PRINT #1,OUT$
: LINE INPUT #1, DISCARD$
: RETURN

: Thanks


--



Tue, 27 Jun 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. a EXE from a BIG Qbasic-Prog?

2. Run Icon prog from inside Qbasic

3. Please Help /w QBasic Prog. 4 Dummies

4. Help, need a qbasic prog compiled!

5. Fond a QB prog. for COM 115200

6. Need advice on getting out of prog to a .com file

7. QBASIC Challenge, QBASIC Webpage, Questions, Etc.

8. COM objects on ASP communicating with running prog

9. opening a prog or window from within a vb prog

10. Prog to Prog Communications

11. Newbiw COM Question - COM Interface?

 

 
Powered by phpBB® Forum Software