Home Getting Started My Stamp Projects Electric Eng. Projects My Robots My PIC Projects PIC Mircontrollers Downloads Links Email



Interfacing the MAX187 ADC to the BSII to measure voltages

Introduction

The MAX187 is an 12 bit one analog input ADC. The MAX187 requires a 3 pin interface to communicate with the Stamp, CS(chip select), DOUT(serial data), and SCLK(serial clock). It requires no external reference voltage or external clock, its all built in to the chip. Analog to Digital converters are a way to interface the Basic Stamp to the analog world. They can measure hundreds of volts, depending on the voltage divider you use. The highest voltage the ADC can read is 4.096V, anything above that and you need to build a voltage divider to put the voltage down to measurable levels.



Code for interfacing with the MAX187 A/D converter to the Basic Stamp II. Schematic for this source code


SCLK con 0
CS con 1
SerData_in con 2
adc var word

main:
gosub convert
gosub print
goto main

print:
debug dec adc
return

convert:
low CS
Shiftin Serdata_in,SCLK,MSBPOST,[adc\12]
high CS
return






Code for interfacing with the MAX187 A/D converter to the Basic Stamp or PIC. Schematic for the source code


symbol adc = W0
symbol count =b2
symbol sclk = 0
symbol cs = 1
symbol serdata = PIN2
symbol pin = 3

dirs=%00001011
low cs
pulsout sclk,1
for count = 0 to 11
adc = adc *2 + serdata
pulsout sclk, 1
next count
high cs




For the complete code including the comments to help you understand and display routines, go to the downloads section and download the code acquired.

Downloads

1 Kb BASIC Stamp II Code
20 Kb Schematic for connecting the MAX187 ADC to the Stamp
177 Kb Datasheet for the MAX187 ADC



Home Stamp Projects EE Projects PIC projects Downloads Getting Started Links Robots

Last update: March 17/2001
Questions or comments email me at shaunwilson19@yahoo.com or

Put your comments or whatever on my message board