Propeller Activity Board A/D Voltage Library  v0.8
Take DC voltage measurements with A/D 0, 1, 2, and/or 3.
Functions
adcDCpropab.c File Reference

Initialize ADC124S021 and measure voltage as a raw, 12-bit5 adc value.

CONSTRUCTION ZONE: This library is preliminary, major revisions pending, not for release. More...

#include "simpletools.h"
#include "adcDCpropab.h"

Functions

int adc124S021dc (int channel)
void adc_init (int csPin, int sclPin, int doPin, int diPin)
 Initialize A/D converter.
int adc_in (int channel)
 Get value that corresponds to voltage measurement on one of the A/D converter's input channels. This number indicates voltage in terms of 4096ths of 5 v.

Detailed Description

Initialize ADC124S021 and measure voltage as a raw, 12-bit5 adc value.

CONSTRUCTION ZONE: This library is preliminary, major revisions pending, not for release.

Author
Andy Lindsay

Function Documentation

int adc_in ( int  channel)

Get value that corresponds to voltage measurement on one of the A/D converter's input channels. This number indicates voltage in terms of 4096ths of 5 v.

Parameters
channelThe A/D converter's input channel, either channel 0, 1, 2, or 3. Marked A/D 0, 1, 2 or 3 on the Propeller Activity Board.
Returns
voltage measurement as a number of 4096ths of 5 V.
void adc_init ( int  csPin,
int  sclPin,
int  doPin,
int  diPin 
)

Initialize A/D converter.

Call this function once before calling adc_in or adc_volts.

Propeller Activity Board Example:

adc_init(21, 20, 19, 18);
Parameters
csPin,PropellerI/O pin connected to the A/D converter's chip select pin.

The Propeller chip uses that pin to enable communication with the A/D converter chip.

This connection is labeled /CS-P21 on the Propeller Activity Board. In that case Propeller I/O pin P21 is connected to the A/D converter's chip select pin, so you would use 21 for this parameter.
sclPin,PropellerI/O pin connected to the A/D converter's serial clock pin.

The Propeller chip sends a series of pulses to the A/D converter's SCL pin to drive the conversion and signal to send/recieve binary conversion values.

This connection is labeled SCL-P20 on the Propeller Activity Board. In that case Propeller I/O pin P20 is connected to the A/D converter's serial clock pin, so you would use 20 for this parameter.
doPin,PropellerI/O pin connected to the A/D converter's data out pin.

The A/D converter sends binary values to the controller with this pin.

This connection is labeled DO-P19 on the Propeller Activity Board. In that case Propeller I/O pin P19 is connected to the A/D converter's data out pin, so you would use 19 for this parameter.
diPin,PropellerI/O pin connected to the A/D converter's data in pin.

The Propeller chip sends a channel selection to the A/D converter, and it receives it with this pin.

This connection is labeled DI-P18 on the Propeller Activity Board. In that case Propeller I/O pin P18 is connected to the A/D converter's chip data in, so you would use 18 for this parameter.