Pololu AVR C_C++ Library Users Guide.pdf
(
649 KB
)
Pobierz
Pololu - Pololu AVR C/C++ Library User's Guide
Pololu AVR C/C++ Library User's Guide
© 2001–2010 Pololu Corporation
Pololu AVR C/C++ Library User's
Guide
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3. Downloading and extracting the files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4. Compiling the Pololu AVR Library (Optional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5. Installation of the Pololu AVR Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6. Example programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
6.a. Example program – AVR Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
6.b. Example program – Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.c. Orangutan Analog Input Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.d. Orangutan Buzzer Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.e. Orangutan Digital I/O Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
6.f. Orangutan LCD Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.g. Orangutan LED Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.h. Orangutan Motor Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.i. Orangutan Pushbutton Interface Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.j. Orangutan Serial Port Communication Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.k. Orangutan Servo Control Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.l. Orangutan SVP Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.m. Pololu QTR Sensor Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.n. Pololu Wheel Encoder functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7. Using the Pololu AVR Library for your own projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
8. Additional resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Page 1 of 47
Pololu AVR C/C++ Library User's Guide
© 2001–2010 Pololu Corporation
1. Introduction
This document is a guide to using the Pololu AVR C/C++ library, including installation instructions, tutorials, and example
programs. The Pololu AVR Library makes it easy for you to get started with the following Pololu products:
1. Introduction
Page 2 of 47
Pololu AVR C/C++ Library User's Guide
© 2001–2010 Pololu Corporation
Pololu 3pi robot
:
a mega168/328-based programmable robot. The 3pi robot essentially contains an SV-328
and a 5-sensor version of the QTR-8RC, both of which are in the list below.
Pololu Orangutan SVP-1284
:
based on the mega1284, the SVP-1284 is our newest Orangutan robot
controller. It is a super-sized version of the SV-328, with a built-in AVR ISP programmer, more I/O lines,
more regulated power, and more memory. It also features hardware that makes it easy to control up to eight
servos with a single hardware PWM and almost no processor overhead.
Pololu Orangutan SVP-324
:
based on the mega324, the SVP-324 is a version of the SVP-1284 with less
memory. The two versions are completely code-compatible (the same code will run on both devices as long
as it’s small enough to fit on the ATmega324PA).
Pololu Orangutan X2
:
based on the mega644, the X2 robot controller is the most powerful Orangutan. It
features an auxiliary microcontroller devoted to controlling much of the integrated hardware (it also acts as
a built-in AVR ISP programmer) and high-power motor drivers capable of delivering hundreds of watts.
Pololu Orangutan SV-328
:
a full-featured, mega328-based robot controller that includes an LCD display.
The SV-328 runs on an input voltage of 6-13.5V, giving you a wide range of robot power supply options,
and can supply up to 3 A on its regulated 5 V bus. This library also supports the original
Orangutan
SV-168
,
which was replaced by the SV-328.
Pololu Orangutan LV-168
:
a full-featured, mega168-based robot controller that includes an LCD display.
The LV-168 runs on an input voltage of 2-5V, allowing two or three batteries to power a robot.
Pololu Baby Orangutan B-48
:
a compact, complete robot controller based on the mega48. The B-48 packs
a voltage regulator, processor, and a two-channel motor-driver into a 24-pin DIP format.
Pololu Baby Orangutan B-328
:
a mega328 version of the above. The mega328 offers more memory for
your programs (32 KB flash, 2 KB RAM). This library also supports the
Baby Orangutan B-168
,
which
was replaced by the Baby B-328.
Pololu QTR-1A
and
QTR-8A
reflectance sensors (analog):
an analog sensor containing IR/
phototransistor pairs that allows a robot to detect the difference between shades of color. The QTR sensors
can be used for following lines on the floor, for obstacle or drop-off (stairway) detection, and for various
other applications.
Pololu QTR-1RC
and
QTR-8RC
reflectance sensors (RC):
a version of the above that is read using
digital inputs; this is compatible with the Parallax QTI sensors.
1. Introduction
Page 3 of 47
Pololu AVR C/C++ Library User's Guide
© 2001–2010 Pololu Corporation
Encoder for Pololu Wheel 42x19 mm
:
a wheel encoder solution that allows a robot to measure how far it
has traveled.
For detailed information about all of the functions available in the library, see the
command
reference
[http://www.pololu.com/docs/0J18]
.
Note that the library is designed for Atmel’s AVR-based boards like the Orangutans: to use it with the QTR sensors, your
controller must be either an Orangutan or another board built with an ATmega48/168/328P or ATmega324PA/644P/1284P
AVR microcontroller.
This document covers the C/C++ version of the library, but it may also be used with
Arduino
[http://www.arduino.cc]
:
a
popular, beginner-friendly programming environment for the mega168/328, using simplified C++ code. See our
guide to
using Arduino with Orangutan controllers
[http://www.pololu.com/docs/0J17]
for more information.
1. Introduction
Page 4 of 47
Pololu AVR C/C++ Library User's Guide
© 2001–2010 Pololu Corporation
2. Prerequisites
The free avr-gcc compiler, avr-libc, and other associated tools must be installed before the Pololu AVR library.
Installing the AVR development tools for Windows
For Windows users, these tools are made available as the
WinAVR distribution
[http://winavr.sourceforge.net/]
.
We also
recommend the
AVR Studio development environment
[http://www.atmel.com/avrstudio/]
, which may be downloaded free
of charge from Atmel. To load your compiled code onto the Pololu Orangutan or 3pi, we recommend the
Pololu USB
AVR Programmer
[http://www.pololu.com/catalog/product/1300]
,
but any AVR ISP programmer will work. If you will be using
a Pololu programmer, follow the
installation instructions
[http://www.pololu.com/docs/0J36]
to install it on your computer,
before continuing with these instructions.
Windows Vista: WinAVR might not work without additional help from this
WinAVR and Windows Vista
Guide
[http://www.madwizard.org/electronics/articles/winavrvista]
Installing the AVR development tools for Linux
Linux users should install all AVR-related packages available in their distribution’s package manager. In particular, under
Ubuntu you will need to install the following packages:
• avr-libc
• gcc-avr
• avra
• binutils-avr
• avrdude (for use with the Pololu Orangutan Programmer)
2. Prerequisites
Page 5 of 47
Plik z chomika:
phill2k
Inne pliki z tego folderu:
libpololu-avr-101104.zip
(2145 KB)
libpololu-avr-100607.zip
(1880 KB)
Pololu_AVR.jpg
(99 KB)
Pololu AVR C_C++ Library Users Guide.pdf
(649 KB)
libpololu-avr-100326.zip
(1878 KB)
Inne foldery tego chomika:
Atmel QTouch Library AVR
AVR-CDC
FatFs R0.07e
LCD_GLCD
LUFA - Lightweight USB Framework for AVRs
Zgłoś jeśli
naruszono regulamin