1 REM paldl.bas : GM C3I 160 bits/second ALDL serial data via Parallel (Printer) Port 2 REM Version 1.0 September 1997 - Its messy but works for me. 3 REM By Seanster 4 REM Email: Seanster@Seanster.com 5 REM Yes, this is terrible coding. I'm sorry. I was in a BIG hurry to write this and have not programmed basic in 10 years. 6 REM Some day, I'll redo this and comment it out... 7 KEY OFF 10 DT = 888 20 st = DT + 1: ct = DT + 2 30 CLS : LOCATE 1, 25: PRINT "\ Parallel Port Analyzer /" 32 LOCATE 2, 25: PRINT " \------------------------/" 90 LOCATE 8, 20: PRINT "Parallel Port Location: "; DT OUT ct, 96 250 D = INP(DT): S = INP(st): c = INP(ct) PRINT "Data ("; DT; "):"; D; " "; PRINT "Status ("; st; "):"; S; PRINT "Control ("; ct; "):"; c samples = 12 PRINT "" 'STACK arrs = wid arr = 0 arrp = 1 ' 500 : 'INPUT "File name"; nam$ 'IF nam$ = "" THEN nam$ = "20ms" 'nam$ = nam$ + ".trc" 'OPEN "c:\trc\" + nam$ FOR BINARY AS #1 'a$ = SPACE$(1) 'b$ = STR$(255) a = 127 b = 127 word = 0 'samp = 10 'SAMP$ = SPACE$(samples) 'SKIP$ = SPACE$(307) ON ERROR GOTO 5000 x = 0 y = 0 z = 0 pas = -99 lwpos = 1 'INPUT "Width of data: ", wid wid = 9 numbytes = 26 'My car outputs 26 separate values (bytes) of data samp = 99 'Simple delay loop timed for my Cyrix P166+ (It's easy to calibrate!) 'INPUT "# Sample Counts: ", samp skp = 0 PRINT "Processing..." 'GET #1, , SKIP$ ' ' ' ' ' 1000 : a = INP(st) 'GET #1, , A$ ' ' ' ' ' ' ' IF a = 127 AND b = 255 THEN x = x + 1 FOR lp = 1 TO samp crap = INP(st) 'GET #1, , SAMP$ NEXT lp a = INP(st) 'GET #1, , A$ IF skp = 0 THEN y = y + 1 IF a = 127 THEN 'PRINT " 0"; 'lwpos = 1 lword = 0 ELSE 'PRINT " 1"; IF y > 1 THEN word = word + (2 ^ (wid - y)) lword = lword + 1 'lwpos = lwpos + 1 'IF lwpos > wid THEN lwpos = 1 IF lword = wid THEN pas = 0 word = (2 ^ (wid + 1)) - 1 lword = 0 y = wid END IF END IF 'FOR lp = 1 TO samp 'crap = INP(st) 'GET #1, , SAMP$ 'NEXT lp IF (y = wid AND pas > 0) THEN PRINT USING "####"; word; '; " - "; lword 'IF lword = 511 THEN pas = 0 word = 0 'lword = 0 END IF IF pas >= 0 THEN pas = pas + 1 IF (pas = numbytes * wid) THEN PRINT "" 'INPUT " "; samp1 IF samp1 > 0 THEN samp = samp1 pas = -99 END IF ELSE IF skp > 0 THEN skp = skp - 1 END IF END IF b = a ' IF y = wid AND pas > 0 THEN y = 0 'PRINT "" q = 0 'FOR q = 1 TO (wid + 1) / 2 ' PRINT "-----"; 'NEXT 'PRINT "" END IF ' ' ' ' 'IF EOF(1) THEN GOTO 60 GOTO 1000 5000 : PRINT "" PRINT "Error!" 60000 : PRINT "" PRINT x; " Bits" CLOSE #1 PRINT "" PRINT "" GOTO 500