Arduino and AVR
Total Page:16
File Type:pdf, Size:1020Kb
Arduino and AVR Ke vin J Dola n a nd Eric Te ve lson Agenda • History of Arduino • Comparison to Other Platforms • Arduino Uno - Hardware • ATmega328P Peripherals • Instruction Set • Processor Components • Pipe lining • Programming • Applica tions • Future of Arduino History of Arduino • Fa mily of Microcontrolle rs cre a te d a s a ma ste rs the sis proje ct • intended for use by a non-technical audience of artists, designers, etc. • Made for accessibility and ease of use. • Programming made easy for the audience • Ability to program board via USB • Inexpensive price point • Expanded for other types and configurations • Example: Arduino Lilypad for wearable technologies • Popularity has expanded functionality including “shields” and Bluetooth. Comparison to Other Platforms • Raspberry Pi • Raspberry Pi is a full computer that can run and support an OS, and has built in graphics. • Porta bility is a n issue , since a n e xte rna l supply is ne e de d. • Network needs more setup on an Arduino • Raspberry Pi does not support analog sensors as well • Teensy • Less expensive • Compatible with Arduino “sketches” and “shields” • Be tte r ADC sa mpling, sa me functiona lity, be tte r re solution • Sma lle r physica l boa rd size Arduino Uno - Hardware • ATmega328P Microcontroller • 3 2 KB Fla s h Me m o ry (2 KB S RAM, 1 KB EEP RO M) • 16 MH z C lo c k • 14 Digita l I/O Pins • 6 PWM Digita l I/O Pins • 6 Analog Input Pins • Up to 20mA DC Current per I/O Pin up to 300mA total across all pins • 50mA DC Current on 3.3V Pin Arduino Uno - Hardware ATmega328P Peripherals • Total of 6 accessible A/D Pins on Port C • 14 GPIO (7 Pins each from PORT B & D) • UART (Se ria l) • SPI Support • Watchdog timer to reset CPU Instruction Set • Harvard Architecture, which is non-von Neumann memory, but still a von Neumann architecture. • Allows separate storage and pathways of data and instructions • Word width, timing and memory address structure can differ • Instruction address zero is not the same as data address zero • Harvard allows both reading an instruction and read/write data at the same time, even with no cache • Allows for more speed, since fetch and execution can be done concurrently • Trade offs include cost and power saving from omitting cache outweighs the programming penalties from featuring distinct code and data address spaces. Processor Components • Arithmetic and Logic operations between registers. • Single cycle ALU instructions • Entire memory space accessible by conditiona l/unconditiona l jumping. • 16 or 32 bit instructions • 26 8-bit registers with three 16-bit registers. • 16 -bit registers must be assessed using two R/W operations on the 8-bit data bus. Pipelining • Ha rva rd a rchite cture a llows pa ra lle l instruction fe tche s a nd e xe cutions • Ma ke s a 2 sta ge pipe line Programming • Programmed in C, called “sketches” • Structure • Header: declarations, includes, etc. • setup(), executes only once when program starts • loop(), continuously re-executed when the end is reached • Main Program: int main(void){ init(); setup(); for (;;) loop(); return 0; } Applications • Combine with “shields”, add on modules for expansion of functions • Control motors for moving objects • Interface with sensors • Make use of screens • Ne twork Future of Arduino • Arduino MEGA • Larger Uno, more I/O • Arduino Zero • 32-bit Uno • Arduino Due • 32-bit MEGA, with ARM core • Arduino Gemma • Sma ll for we a ra ble s Sources • https://www.arduino.cc/en/Main/Products?from=Main.Hardware (Arduino Ha rdwa re Listing) • http://www.atmel.com/Images/doc8161.pdf (AVR Da ta She e t) • http://courses.cs.washington.edu/courses/csep567/10wi/lectures/Lecture6.pdf (ATMega328 and Arduino Lecture from University of Washington) • http://www.kenleung.ca/portfolio/arduino-a-brie f-history-3/ (History of Arduino Paper) Thank You Any Questions? .