Hi, I need to find out what these lines of code are doing? The purpose of the code is to get information from a machine via RS232. The string of information this prog is getting, is being manipulated but I can't figure out what hell its doing to the string? I'm not a QBasic programmer so Any help explaining these 6/7 lines would be appreciated. Thanks in advance.
'Read from inst
'---------------------------------------
OPEN "COM1:9600,S,7,1,CD0,CS0,DS0,OP0,RS" FOR RANDOM AS #1
c1! = 0
c1$ = ""
s1$ = ""
a$ = CHR$(27) + "P": PRINT #1, a$
s1$ = "": c1$ = ""
a$ = INPUT$(15, #1)
CLOSE
s1$ = LEFT$(a$, 1)
c1$ = MID$(a$, 3, 8 )
c1! = VAL(c1$) 'inst value
IF in = 2 THEN c1! = c1! * 10
IF s1$ = "-" THEN c1! = -c1! 'Convert to -ve val if -sign
Qbasic Rs232 Code Explanation
in Programming
Posted
Hi, I need to find out what these lines of code are doing? The purpose of the code is to get information from a machine via RS232. The string of information this prog is getting, is being manipulated but I can't figure out what hell its doing to the string? I'm not a QBasic programmer so Any help explaining these 6/7 lines would be appreciated. Thanks in advance.
'Read from inst
'---------------------------------------
OPEN "COM1:9600,S,7,1,CD0,CS0,DS0,OP0,RS" FOR RANDOM AS #1
c1! = 0
c1$ = ""
s1$ = ""
a$ = CHR$(27) + "P": PRINT #1, a$
s1$ = "": c1$ = ""
a$ = INPUT$(15, #1)
CLOSE
s1$ = LEFT$(a$, 1)
c1$ = MID$(a$, 3, 8 )
c1! = VAL(c1$) 'inst value
IF in = 2 THEN c1! = c1! * 10
IF s1$ = "-" THEN c1! = -c1! 'Convert to -ve val if -sign
RETURN