DECLARE SUB od (w!) DECLARE SUB oc (en!, rw!, rs!) DECLARE SUB write4 (w!, rs!, ms!) DECLARE SUB delay (ms!) DECLARE SUB write8 (w!, rs!, ms!) DECLARE SUB idle () DECLARE SUB initlcd (n!) DECLARE SUB printlcd (sttp AS STRING) ' This file is mostly a creation of and by Adam Davis, 2000 ' This is all public domain stuff. I don't remember how I ' connected the LCD, though I suspect the data lines ' were connected directly to the LCD. If you look at the ' oc routine you'll find what bits I'm twiddling aside from data ' I provide no support for this file - it is presented as is. ' Use at your own risk. ' No, there are no real comments worth speaking of. '81 y = 0 DIM char(64) char(0) = &H18 char(1) = &H18 char(2) = &H7 char(3) = &H4 char(4) = &H6 char(5) = &H4 char(6) = &H4 char(7) = &H0 char(8) = &H18 char(9) = &H18 char(10) = &H3 char(11) = &H4 char(12) = &H4 char(13) = &H4 char(14) = &H3 char(15) = &H0 FOR x = 16 TO 63 char(x) = 0 NEXT x btime = 10000 wtime = 1000 initlcd 1 'write8 &H80, 0, wtime 'FOR x = 0 TO 7: write8 x, 1, 10000: NEXT x write8 &H40, 0, wtime FOR x = 0 TO &H40 write8 char(x), 1, 100 NEXT x write8 1, 0, btime printlcd "100" write8 0, 1, 100 printlcd " 100" write8 1, 1, 100 printlcd " 100" write8 2, 1, 100 write8 &HC0, 0, btime printlcd "100" write8 3, 1, 100 printlcd " 100" write8 4, 1, 100 printlcd " 100" write8 5, 1, 100 loopit: ky$ = INKEY$ IF ky$ = "" THEN GOTO loopit IF ky$ = CHR$(27) THEN END IF ky$ = CHR$(7) THEN write8 1, 0, 100 ELSE write8 ASC(ky$), 1, 10 END IF GOTO loopit DATA &H18,&H18, &H7, &H4, &H6, &H4, &H4, &H0 DATA &H18,&H18, &H3, &H4, &H4, &H4, &H3, &H0 DATA 0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0 DATA 0,0,0,0,0,0,0,0 SUB delay (ms) FOR x = 0 TO ms PRINT ; NEXT x END SUB SUB idle oc 0, 1, 1 END SUB SUB initlcd (n) STATIC doit tdel = 1000 idle delay 15 write4 3, 0, tdel write4 3, 0, tdel write4 3, 0, tdel write4 2, 0, tdel IF n = 1 THEN x = &H28 ELSE x = &H20 END IF write8 x, 0, tdel write8 6, 0, tdel write8 1, 0, tdel write8 &HF, 0, tdel idle IF doit = 0 THEN write8 &H80, 0, 10000 printlcd "LCD INITIALIZED" write8 &H80 + &H40, 0, 10000 printlcd "Adam is so COOL!" doit = 1 END IF END SUB SUB oc (en, rw, rs) x = 0 IF en = 1 THEN x = x + 1 IF rw = 1 THEN x = x + 2 IF rs = 1 THEN x = x + 4 OUT 956, x END SUB SUB od (w) OUT 958, w XOR &HB END SUB SUB printlcd (sttp AS STRING) FOR x = 1 TO LEN(sttp) write8 ASC(MID$(sttp, x, 1)), 1, 1000 NEXT x END SUB SUB write4 (w, rs, ms) od w oc 0, 0, rs oc 1, 0, rs oc 0, 0, rs delay ms END SUB SUB write8 (w, rs, ms) write4 INT(w / (16)), rs, 10 write4 w AND &HF, rs, ms END SUB