100 'Driver routine, A/D read demonstration. 105 ' 110 GOSUB 10140 'call initialisation routine 120 GOSUB 10160 'call dual-slope A/D read to 'adval$' 130 PRINT adval$ 'print result 140 GOTO 120 'loop. 150 ' 160 ' 10000 '----------------------------------------------------- 10010 ' SCIENTIFIC INTERFACE DRIVER ROUTINES 10020 ' ---------------------------------------------------- 10030 ' Scientific interface initialisation and call 10040 ' 10050 ' Call the first of the 'GOTO' statements at start- 10060 ' - to call machine-code file. 10070 ' Then use the other 'GOTO' statements as- 10080 ' - required. 10090 ' ---------------------------------------------------- 10100 ' 10110 '----------------------------------------------------- 10120 'Jump table. Call interface operations from here. 10130 ' 10140 GOTO 10310 'Initialisation. Call this once at start. 10150 ' 10160 GOTO 10370 'Do one dual-slope A/D read to 'adval$'. 10170 GOTO 10470 'One read of 8-bit A/D converter to 'adval' 10180 GOTO 10440 'Send 'daval' (0-255) to D/A. 10190 GOTO 10540 'Send value in 'outval' to 8-bit TTL out. 10200 GOTO 10570 'Read 8-bit TTL input to 'inval'. 10210 ' 10220 GOTO 10390 'Dual-slope A/D looping test routine. 10230 GOTO 10510 '8-bit A/D looping test routine. 10240 ' 10250 '----------------------------------------------------- 10260 ' 10270 '----------------------------------------------------- 10280 ' Initialisation. Calls DRV.COM machine-code routine- 10290 ' - to reserved memory space. 10300 ' 10310 mypos=61443! : MEMORY mypos-1 'mem points my space resvd 10320 a=mypos : OPEN "I",1,"drv.com" 'open machine code file 10330 m=ASC(INPUT$(1,#1)) : POKE a,m : a=a+1 10340 IF NOT EOF(1) THEN 10330 ELSE CLOSE #1 : RETURN 10350 ' 10360 '----------------------------------------------------- 10370 'Make one dual-slope A/D reading to 'adval$'. 10380 adval$="+0.519" : a=61443! : CALL a(adval$) : RETURN 10390 '----------------------------------------------------- 10400 'Dual-slope A/D test routine. Loops printing result. 10410 GOSUB 10310 'initialise 10420 adval$="+0.748" : a=61443! : CALL a(adval$) 10430 PRINT adval$ : GOTO 10420 'read and loop testing 10440 '----------------------------------------------------- 10450 'Send value in 'daval' (0-255) to D/A converter. 10460 a=daval MOD 256 : OUT &HA2,a : RETURN 10470 '----------------------------------------------------- 10480 'Read 8-bit A/D converter to 'adval' (0-255). 10490 OUT &HA0,0 'trigger it 10500 adval=INP(&HA2) : RETURN 'read and out 10510 '----------------------------------------------------- 10520 '8-bit A/D looping test routine. 10530 GOSUB 10170 : PRINT adval : GOTO 10530 'loop reading 10540 '----------------------------------------------------- 10550 'Send value in 'outval' to 8-bit TTL out. 10560 a=outval MOD 256 : OUT &HA1,a : RETURN 10570 '----------------------------------------------------- 10580 'Read 8-bit TTL input to 'inval'. 10590 inval=INP(&HA1) : RETURN 10600 '----------------------------------------------------- 10610 ' END OF SCIENTIFIC INTERFACE DRIVER ROUTINES 10620 '-----------------------------------------------------