analog.h File Reference

Contains functions and definitions for using the ADC. More...

#include <inttypes.h>

Go to the source code of this file.

Data Structures

struct  adc_t
 Struct to hold the value of a particular analog port. More...

Defines

#define AN0   0x00
 Analog port 0.
#define AN1   0x01
 Analog port 1.
#define AN2   0x02
 Analog port 2.
#define AN3   0x03
 Analog port 3.
#define AN4   0x04
 Analog port 4.
#define AN5   0x05
 Analog port 5.
#define AN6   0x06
 Analog port 6.
#define AN7   0x07
 Analog port 7.
#define AN8   0x08
 Analog port 8.
#define AN9   0x09
 Analog port 9.
#define AN10   0x0A
 Analog port 10.
#define AN11   0x0B
 Analog port 11.
#define AN12   0x0C
 Analog port 12.
#define AN13   0x0D
 Analog port 13.
#define AN14   0x0E
 Analog port 14.
#define AN15   0x0F
 Analog port 15.
#define BOM_PORT   AN0
 BOM_PORT analog port for BOM.
#define EXT_MUX   AN7
 EXT_MUX analog port.
#define WHEEL_PORT   AN10
 Analog port for the wheel.
#define BATT_PORT   AN11
 Analog port for the battery voltage detector.
#define ADC_START   1
#define ADC_STOP   0
#define ADMUX_OPT   0x60

Functions

void analog_init (int start_conversion)
 Initialize analog ports. Will start running a loop if start_conversion is ADC_START.
void analog_start_loop (void)
 starts the analog loop. Doesn't do anything if the loop is already running.
void analog_stop_loop (void)
 Stops the analog loop. Doesn't do anything if the loop is already stopped.
unsigned int analog8 (int which)
 Returns an 8-bit analog value from the look up table. Use this instead of analog_get8.
unsigned int analog10 (int which)
 Returns an 10-bit analog value from the look up table. Use this instead of analog_get10.
int wheel (void)
 Read the position of the wheel.
unsigned int analog_get8 (int which)
 Read an 8-bit number from an analog port. Loop must be stopped for this to work.
unsigned int analog_get10 (int which)
 Read a 10-bit number from an analog port. Loop must be stopped for this to work.


Detailed Description

Contains functions and definitions for using the ADC.

Copyright (c) 2007 Colony Project

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contains definitions and function prototypes for using the ADC to detect analog signals on pins AN0 - AN7. AN6 and AN7 are used for the wheel and battery.

The pins labeled E6 and E7 are external interrupt pins and are not related to analog.

Author:
Colony Project, CMU Robotics Club, based on firefly code by Tom Lauwers

Generated on Mon Sep 7 19:07:28 2009 for libdragonfly by  doxygen 1.5.9