PropWare
2.1.2
C++ objects and CMake build system for Parallax Propeller
|
Click here for docs on the
develop
branch.
Measure ADC124S021 for signal recording and measurements. For the voltmeter version, check out the DC version of this library: adcACpropab. More...
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | AdcMailbox |
structure for exchanging information with cogc program running in other cog. More... | |
struct | AdcBox |
structure for exchanging information with cogc program running in other cog. More... | |
Typedefs | |
typedef struct AdcMailbox | AdcMailbox_st |
structure for exchanging information with cogc program running in other cog. | |
typedef struct AdcBox | AdcBox_st |
structure for exchanging information with cogc program running in other cog. | |
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. | |
Measure ADC124S021 for signal recording and measurements. For the voltmeter version, check out the DC version of this library: adcACpropab.
Definition in file adcACpropab.h.
struct AdcMailbox |
structure for exchanging information with cogc program running in other cog.
Definition at line 36 of file adcACpropab.h.
Class Members | ||
---|---|---|
unsigned int * | addr | |
int | clk | |
int | cs | |
int | din | |
int | dout | |
int | mask | |
int | stidx |
struct AdcBox |
structure for exchanging information with cogc program running in other cog.
Definition at line 50 of file adcACpropab.h.
Class Members | ||
---|---|---|
AdcMailbox_st | mailbox |
int adc_start | ( | int | doPin, |
int | diPin, | ||
int | clkPin, | ||
int | csPin, | ||
int | pattern, | ||
int * | arrayAddr | ||
) |
Launch A/D converter process into other cog.
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.