A BASIC Challenge!!! (A call for help!)-email replies please
I'm sorry, I forgot to mention to please send your replies by email to
Thanks,
Scott Sternfeld
Hi all-
Maybe you can help me direct my message to the appropriate place, but
hopefully I found the right people to help.
I have a program written in BASIC running on Qbasic. It is a program
that
interfaces with an oscilliscope to obtain wafeform data.
The problem is, on a random number of cycles through the program, it
will
just freeze. My guess is some kind of buffer error. But I can't figure
out the loops and the context.
If anyone wants the challenge of figuring this out, it can be re-written
in Visual Basic, C, or any language you want where I can run this on a
pc
somehow.
A monetary reimbur{*filter*}t may also be available.
Thank you for your time.
**Scott Sternfeld**
This is for a LeCroy 9360 Oscilliscope, and I have the Remote Control
manual as well.
-----start program----
OPEN "COM1:9600,n,8,1" FOR RANDOM AS #1 LEN = 256
1 CLS : PRINT , "PROGRAM TO RETURN WAVEFORM FROM 9360 OSCILLOSCOPE"
PRINT , "Output file name";
INPUT f$
cr$ = CHR$(13)
PRINT #1, CHR$(27) + "C"
PRINT #1, CHR$(27) + "["
OPEN f$ FOR OUTPUT AS #2
PRINT , "Enter number of shots to avg";
INPUT nshts
XOFF$ = CHR$(19)
XON$ = CHR$(17)
B$ = "ZZZ"
wfn = 0
8 PRINT #1, "CLSW" + cr$
s = TIMER
WHILE TIMER < (s + .1 * nshts)
WEND
FOR YY = 1 TO 1500: NEXT YY
555 PRINT #1, "PAST? CUST,AVG"
tzt = TIMER
WHILE TIMER < tzt + .5: WEND
IF LOC(1) = 0 THEN
GOTO 555
ELSE
bo$ = INPUT$(LOC(1), #1)
PRINT #2, bo$
END IF
COMD$ = "TC:INSP? 'SIMPLE'"
GOSUB 80
9 wfn = wfn + 1
LOCATE 4, 1: PRINT , "Downloaded waveform #", wfn
LOCATE 5, 1: PRINT , "Hit any key to continue, x to exit";
v$ = INPUT$(1)
IF v$ <> "x" THEN
LOCATE 5, 1: PRINT , " "
GOSUB 1000
GOTO 8
END IF
10 END
REM Subroutine to gather data from the oscilloscope
80 PRINT #1, "WFSU SP,0,NP,0"
PRINT #1, "COmm_RS232 LL,80, EO,'ZZZZZZZZZZZ'"
90 PRINT #1, COMD$ + cr$
400 FOR DELAY = 1 TO 2000: NEXT DELAY
402 FOR DELY = 1 TO 2000: NEXT DELY
IF LOC(1) = 0 THEN
nl1 = nl1 + 1
IF nl1 = 20 GOTO 80
GOTO 400
END IF
504 IF LOC(1) < 250 THEN
LOCATE 7, 1: PRINT , LOC(1)
A$ = INPUT$(LOC(1), #1)
PRINT #2, A$;
IF INSTR(A$, B$) > 0 THEN
PRINT #2, " ";
GOTO 9
END IF
END IF
506 IF LOC(1) > 250 THEN PAUSE = TRUE: PRINT #1, XOFF$;
REM LOCATE 7, 1: PRINT , LOC(1)
507 C$ = INPUT$(LOC(1), #1)
PRINT #2, C$; : IF LOC(1) > 0 THEN 504
IF INSTR(C$, B$) > 0 THEN
PRINT #2, " ";
GOTO 9
END IF
511 IF PAUSE THEN PAUSE = FALSE: PRINT #1, XON$;
GOTO 402
900 RETURN
REM Subroutine to clear input and output buffers
1000 dp$ = INPUT$(LOC(1), #1): PRINT #2, dp$
1005 PRINT #1, CHR$(27) + "C"
1006 PRINT #1, CHR$(27) + "["
1010 FOR zztop = 1 TO 2000: NEXT zztop
IF LOC(1) > 0 THEN
GOTO 1000
END IF
1020 RETURN