
1070 PRINT V
1080 NEXT MUXCHAN
1090 END
2000 REM Set constants
2010 PAUSE = 0.1: REM For the 141, enter settling time + 0.1
2020 ADC = [value]: REM Your A/D board address
2030 BOARDCODE = [value]: REM 128 for Model 141, 0 for others
2040 CH = [value]: REM Your A/D board channel
2050 RETURN
3000 REM Delay for settling time of PAUSE sec.
3010 IF TIMER > 86395 THEN GOTO 3010
3020 START = TIMER
3030 IF TIMER < START + PAUSE THEN GOTO 3030
3040 RETURN
Include this subroutine if you are using a Model 140.
4000 REM Returns Model 140 voltage in millivolts
4010 OUT ADC + 1, 0
4020 IF INP(ADC) AND 128 THEN 4020
4030 X = INP(ADC)
4040 V = X MOD 16 + (INP(ADC + 1) MOD 16) * 10 + (INP( ADC + 2)
MOD 16) * 100 + (INP(ADC + 3) MOD 16) * 1000
4050 IF X AND 32 THEN V = V + 10000
4060 IF X AND 64 THEN V = -V
4070 V = V * .25
4080 RETURN
Include this subroutine if you are using a Model 134. In
line 4030, you may set AVERAGE anywhere from 1 to 255. Larger
numbers reduce noise while smaller numbers increase speed.
4000 REM Returns Model 134 voltage in millivolts
4010 GOSUB 3000
4020 X = INP(ADC)
4030 TOTAL = 0: AVERAGE = 20
4040 FOR X = 1 TO AVERAGE
4050 IF INP(ADC - 1) AND 2 THEN 4050
4060 V = INP(ADC + 1) * 256! + INP(ADC)
4070 TOTAL = TOTAL + V
4080 NEXT X
4090 TOTAL = TOTAL / AVERAGE: V = (TOTAL - 32768) * .152588
4100 RETURN
Include this subroutine if you are using a Model 141.
4000 REM Returns Model 141 voltage in millivolts
4010 GOSUB 3000
4020 OUT ADC + 1, 1
4030 H = (INP(ADC + 2) AND &H0F)
4040 M = INP(ADC + 1)
4050 L = INP(ADC)
4060 OUT ADC + 1, 0
4070 COUNT = L + M * 256 + H * 65536
4080 V = COUNT * 9.536743E-03 - 5000
4090 RETURN
The above program will print the voltages at channels zero
through 15 of the Multiplexer connected to input CH of the A/D