Pololu AVR Library Command Reference.pdf
(
545 KB
)
Pobierz
Pololu - Pololu AVR Library Command Reference
Pololu AVR Library Command Reference
© 2001–2010 Pololu Corporation
Pololu AVR Library Command
Reference
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Orangutan Analog-to-Digital Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3. Orangutan Buzzer: Beeps and Music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4. Orangutan Digital I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5. Orangutan LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6. Orangutan LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7. Orangutan Motor Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8. Orangutan Pulse/PWM Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
9. Orangutan Pushbuttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
10. Orangutan Serial Port Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
11. Orangutan Servos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
12. Orangutan SPI Master Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
13. Orangutan SVP Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
14. Orangutan System Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
15. Orangutan X2 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
16. QTR Reflectance Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
17. Timing and Delays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
18. Wheel Encoders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
19. 3pi Robot Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Page 1 of 65
Pololu AVR Library Command Reference
© 2001–2010 Pololu Corporation
1. Introduction
This document describes a programming library designed for use with Pololu products. The library is used to
create programs that run on Atmel ATmega1284P, ATmega644P, ATmega324PA, ATmega328P, ATmega168
and ATmega48 processors, and it supports the following products:
1. Introduction
Page 2 of 65
Pololu AVR Library Command Reference
© 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 65
Pololu AVR Library Command Reference
© 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.
The library is written in C++ with C wrapper functions of all of the methods and may be used in three different
programming environments:
•
C++:
supported by the AVR-GCC/WinAVR project. See the
Pololu AVR C/C++ Library User’s
Guide
[http://www.pololu.com/docs/0J20]
to get started.
•
C / AVR Studio:
bindings to the C language are included in the library so that you can write programs
entirely in C, which is the standard for Atmel’s
AVR Studio
[http://www.atmel.com/avrstudio/]
. See the
Pololu
AVR C/C++ Library User’s Guide
[http://www.pololu.com/docs/0J20]
to get started.
•
Arduino
[http://www.arduino.cc]
:
a popular, beginner-friendly programming environment for the
ATmega168/328, using simplified C++ code. We have written
a guide to using Arduino with Orangutan
controllers
[http://www.pololu.com/docs/0J17]
to help you get started.
1. Introduction
Page 4 of 65
Pololu AVR Library Command Reference
© 2001–2010 Pololu Corporation
2. Orangutan Analog-to-Digital Conversion
The OrangutanAnalog class and the C functions in this section make it easy to use to the analog inputs and
integrated analog hardware on the Orangutan robot controllers (LV, SV, SVP, X2, and Baby Orangutan) and 3pi
robot. These functions take care of configuring and running the analog-to-digital converter.
For a higher level overview of this library and example programs that show how this library can be used, please
see
Section 6.c
of the
Pololu AVR C/C++ Library User’s Guide
[http://www.pololu.com/docs/0J20]
.
2. Orangutan Analog-to-Digital Conversion
Page 5 of 65
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