PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
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"
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... | |
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.
Definition in file adcDCpropab.h.
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.
channel | The 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. |
Definition at line 29 of file adcDCpropab.c.
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:
csPin,Propeller | I/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,Propeller | I/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,Propeller | I/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,Propeller | I/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.
float adc_volts | ( | int | channel | ) |
Get a voltmeter style floating point voltage measurement from one of the A/D converter's input channels.
channel | The 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. |
Definition at line 17 of file adcDCVpropab.c.