PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Functions
adcDCpropab.h File Reference

Measure ADC124S021 as either a voltage or a raw, 12-bit5 adc value. This library is intended for DC measurements. For signal measurements, check use the AC version of this library: libadcACpropab. More...

#include "simpletools.h"
+ Include dependency graph for adcDCpropab.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void adc_init (int csPin, int sclPin, int doPin, int diPin)
 Initialize A/D converter. More...
 
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. More...
 
float adc_volts (int channel)
 Get a voltmeter style floating point voltage measurement from one of the A/D converter's input channels.
More...
 

Detailed Description

Measure ADC124S021 as either a voltage or a raw, 12-bit5 adc value. This library is intended for DC measurements. For signal measurements, check use the AC version of this library: libadcACpropab.

Author
Andy Lindsay
Version
0.85

Definition in file adcDCpropab.h.

Function Documentation

◆ adc_in()

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.

Definition at line 29 of file adcDCpropab.c.

+ Here is the caller graph for this function:

◆ adc_init()

void adc_init ( int  csPin,
int  sclPin,
int  doPin,
int  diPin 
)

Initialize A/D converter.

@detail 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.

Definition at line 21 of file adcDCpropab.c.

◆ adc_volts()

float adc_volts ( int  channel)

Get a voltmeter style floating point voltage measurement from one of the A/D converter's input channels.

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
Floating point value that represents the voltage measurement.
Examples
MeasureVolts_Demo.c.

Definition at line 17 of file adcDCVpropab.c.

+ Here is the call graph for this function:
adc_init
void adc_init(int csPin, int sclPin, int doPin, int diPin)
Initialize A/D converter.
Definition: adcDCpropab.c:21