Home | Articles | Projects | Downloads | YouTube Channel   

Select the desired language Greek English

Home Projects [You are here...]
Serial ADC for BS2.

Connect National's Semiconductors serial analog to digital converter ADC0831 to Basic Stamp 2 and digitize your analog data. The required program couldn't be simpler (literally only 3 commands).


There are many implementations of analog to digital converters. However none of them can be compared to simplicity with this. We need only three available ports from Basic stamp 2.

Also you will need a stabilized 9 Volt external power supply (a 9Volt alkaline battery is the best choice).

Schematic Diagram

There is now schematic. Just connect the components on the BS2 board's breadboard like the following picture.

Attention: The 1M trimmer you see in the picture is actually not necessary. We only use it for demonstration purposes (to generate the analog voltage we want to convert). Instead of the trimmer you can apply the analog voltage, you want to convert, directly to pin 2 of the ADC0831 chip (referenced to the ground Vss).


The program

The program is the definition of simplicity. We reed the converted data (meaning the digitized analog voltage) with only one SHIFTIN command.  Before that we enable the chip bys setting the appropriate port to low (in our case port P2). After the SHIFTIN command we set P2 high again.

LOW 2 ' Enable ADC0831
SHIFTIN 0,1,MSBPOST,[ADResult\9] ' Read the converted data
HIGH 2 ' Disable ADC0831

ADResult is the byte where the digitized voltage will be saved.

I wrote a simple program to demonstrate this. Download the source code: ADC0831.zip

Created: 20/09/2005
Updated: -

Home | Articles | Projects | Downloads | YouTube Channel
Copyright © 1997 - 2009 Dimitris Piperidis. All rights reserved