Download presentation
Presentation is loading. Please wait.
Published byHana Konečná Modified over 6 years ago
1
The Arduino Microcontroller: Atmel AVR Atmega 328
Features • Low-power AVR 8-bit Microcontrollerre Advanced RISC ArchitectuHigh-performance, – 131 Powerful Instructions – Most Single-clock Cycle Execution – 32 x 8 General Purpose Working Registers • Memories – 32K Bytes of In-System Self-Programmable Flash – 1024 Bytes EEPROM – 2K Byte Internal SRAM • Peripheral Features – Two 8-bit Timer/Counters – One 16-bit Timer/Counter – Six PWM Channels – 6-channel, 10-bit ADC – Programmable Watchdog Timer – On-chip Analog Comparator • I/O and Packages – 32 Programmable I/O Lines • Speed Grades – MHz for ATmega32L – MHz for ATmega32
2
Detailed ATMega-328 Architecture
3
On chip-Memory Memory Flash (32K) (15-bit addresses)
Program memory – read only Non-volatile Allocate data to Flash using PROGMEM keyword SRAM (2K) Temporary values, stack, etc. Volatile Limited space EEPROM (1K) Long-term data
4
AVR CPU Instruction Fetch and Decode
5
AVR Register File 32, 8-bit GP registers Part of SRAM memory space
6
Interrupt Unit Watchdog Timer Unit Analog Comparator Different I/O modules EEPROM Different I/O lines
7
Timers Three timers Very flexible Choose clock rate
Choose “roll-over” value Generate interrupts Generate PWM signals (represent 8-bit value with using a clock signal) Arduino Timing Functions Delay(ms) wait for ms milliseconds before continuing Delay Microseconds(us) wait for us microseconds before continuing Unsigned long millis( ) return number of milliseconds since program started Unsigned long micros( ) return number of microseconds since program started
8
I/O Ports Interface to pins Some pins are special
3 8-bit Ports (B, C, D) Each pin directly programmable Program direction Program value Program pull-ups Some pins are special Analog vs. Digital Clocks Reset
9
Arduino Digital and Analog I/O Pins
Digital pins: Pins 0 – 7: PORT D [0:7] Pins 8 – 13: PORT B [0:5] Pins 14 – 19: PORT C [0:5] (Arduino analog pins 0 – 5) digital pins 0 and 1 are RX and TX for serial communication digital pin 13 connected to the base board LED Digital Pin I/O Functions pinMode(pin, mode) Sets pin to INPUT or OUTPUT mode Writes 1 bit in the DDRx register digitalWrite(pin, value) Sets pin value to LOW or HIGH (0 or 1) Writes 1 bit in the PORTx register int value = digitalRead(pin) Reads back pin value (0 or 1) Read 1 bit in the PINx register
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.