PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
Launch ADC124S021 process into cogc cog.
CONSTRUCTION ZONE: This library is preliminary, major revisions pending, not for release.
More...
Go to the source code of this file.
Functions | |
int | adc_start (int doPin, int diPin, int clkPin, int csPin, int pattern, int *arrayAddr) |
Launch A/D converter process into other cog. More... | |
void | adc_stop (void) |
Stop A/D conversion process and free up a cog. | |
Variables | |
static int | cog = 0 |
static AdcBox_st | adcbox |
Launch ADC124S021 process into cogc cog.
CONSTRUCTION ZONE: This library is preliminary, major revisions pending, not for release.
Definition in file adcACpropab.c.
int adc_start | ( | int | doPin, |
int | diPin, | ||
int | clkPin, | ||
int | csPin, | ||
int | pattern, | ||
int * | arrayAddr | ||
) |
Launch A/D converter process into other cog.
@detail After you call this function, the adc process will go as fast as it can and store results in an array. You will have to pass it pin, pattern, and array address parameters. The pattern is a four-digit binary value that allows you to tell the process which channels to monitor and update. The array address is the array where the ADC process will store the perpetually updated, latest set of measurement results.
[b] Propeller Activity Board Example[/b]
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. |
pattern,Four | bit binary number that tells which channels to use update in the array. For example, if you only want to monitor channels 2 and 0, use 0b0101. If you instead want to monitor channels 3, and 2, use 0b1100. |
array,Address | of the four int array that will receive the updates. Channel-3 measurement goes into array[3], channel-2 into array[2], and so on. Regardless of how many channels you intend to monitor, make sure to declare an in array with four elements. At the start, the process will store -1 in any slots that the pattern parameter says not to monitor. After that, it skips those slots and only updates the array elements that pattern says to monitor. |
Definition at line 20 of file adcACpropab.c.