Electronics Btrieve Motorcycling Software If you find this site useful and want to support, click on few ads to throw some money into hat.

12-bit ADC for BASIC-52

ADS1286 is a nice little ADC with up to 20kHz sample rate, internal S&H circuit, and sucks up less than 500uA while operating (only 3uA in shutdown). It comes in 8-pin DIP (hobbyist friendly!) and SOIC packages and is very easy to use. External VREF allows you to set appropriate input range for your application. It is not very cheap, and only has one input (although differential) but other than these, it is lovely. As you can see from the schematics and sample code, it is both easy to hook up and easy to program for. The sample below takes ADC readings and just prints them. Run it and turn the pot, you should see the reading chage from almost 0 to almost 4096, with 5V VREF the output resolution is about 1.2mV.

10 REM ADS1286 demo v1

15 GOSUB 1050
20 GOSUB 1200
30 PRINT AV
40 GOTO 20

1000 REM start conversion
1010 PORT1=0FFH
1015 PORT1=07DH
1020 RETURN

1050 REM stop ADC
1060 PORT1=0FFH
1070 RETURN

1100 REM one clock, leaves clock high
1110 PORT1=07DH
1120 PORT1=07FH
1130 RETURN

1200 REM take ADC reading
1210 GOSUB 1000
1215 AV=0
1220 GOSUB 1100 : GOSUB 1100 : GOSUB 1100
1230 FOR I=1 TO 12
1240 GOSUB 1100
1250 BT=PORT1.AND.1
1260 AV=AV+AV+BT
1270 NEXT I
1280 GOSUB 1050
1290 RETURN

Want to get voltage reading. No problem. Just measure the VREF voltage, and modify the program to read (set V to your VREF voltage on line 16):

10 REM ADS1286 demo v1

15 GOSUB 1050
16 V=5.1
20 GOSUB 1200
30 PRINT V/4096*AV
40 GOTO 20

...

Copyright © Madis Kaal 2000-