Lecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Similar documents
AVR Microcontrollers Architecture

ARDUINO MEGA INTRODUCTION

AVR- M16 development board Users Manual

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

AVR Training Board-I. VLSI Design Lab., Konkuk Univ. LSI Design Lab

VLSI Design Lab., Konkuk Univ. Yong Beom Cho LSI Design Lab

MICROPROCESSOR BASED SYSTEM DESIGN

Arduino Uno R3 INTRODUCTION

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Module 2: Introduction to AVR ATmega 32 Architecture

Clock and Fuses. Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar

LAMPIRAN. Universitas Sumatera Utara

8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200

ATmega128. Introduction

8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary

8-bit Microcontroller with 2K Bytes of Flash. ATtiny28L ATtiny28V

8-bit Microcontroller with 1K Bytes Flash. ATtiny10 ATtiny11 ATtiny12. Preliminary. Features. Pin Configuration

8-bit Microcontroller with 1K Byte Flash. ATtiny11. ATtiny12

8-bit Microcontroller with 4K Bytes In-System Programmable Flash. ATtiny40. Preliminary

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features.

ATmega8A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET COMPLETE

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

University of Kashan Faculty of Electrical and Computer Engineering Department of Computer Engineering. Lecture note 2

8-bit Microcontroller with 1K Byte Flash. ATtiny15L

Programming Microcontroller Assembly and C

8-bit Atmel with 8KBytes In- System Programmable Flash. ATmega8 ATmega8L. Summary

8-bit Microcontroller with 8K Bytes In-System Programmable Flash. ATmega8515 ATmega8515L. Features

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L

8-bit Atmel Microcontroller with 8KB In-System Programmable Flash. ATmega8A

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description

Mechatronics and Microcomputers. Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD

Microprocessors And Microcontroller

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

8051 Microcontroller

MOD-IO development board Users Manual

ATmega128A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET COMPLETE

AVR Microcontroller with Core Independent Peripherals and PicoPower technology

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313

8-bit Atmel Microcontroller with 16K/32K/64K Bytes In-System Programmable Flash

8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8.

2011 Pearson Higher Education, Mazidi, Naimi, and Naimi Pearson Higher Education, 2011 Pearson Higher Education,

CHAPTER 1 MICROCOMPUTER SYSTEMS. 1.1 Introduction. 1.2 Microcontroller Evolution

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261 ATtiny461 ATtiny861. Automotive

Computer Hardware Requirements for ERTSs: Microprocessors & Microcontrollers

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega169V ATmega169. Features. Notice: Not recommended in new designs.

8-Bit Microcontroller with 1K bytes In-System Programmable Flash AT90S1200. Features. Description. Pin Configuration

VCC PB2 (SCK/ADC1/T0/PCINT2) PB1 (MISO/AIN1/OC0B/INT0/PCINT1) PB0 (MOSI/AIN0/OC0A/PCINT0)

EE 308: Microcontrollers

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

ATmega8A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET SUMMARY

ECED3204: Microprocessor Part I--Introduction

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L. Preliminary. Features

ATmegaS128. Introduction. Features

CN310 Microprocessor Systems Design

APPLICATION NOTE. AT11008: Migration from ATxmega16D4/32D4 Revision E to Revision I. Atmel AVR XMEGA. Introduction. Features

SBAT90USB162 Atmel. SBAT90USB162 Development Board User s Manual

8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash. ATtiny261/V ATtiny461/V ATtiny861/V. Preliminary

Embedded programming, AVR intro

LBAT90USB162 Atmel. LBAT90USB162 Development Board User s Manual

8-bit Atmel Microcontroller with 8/16K Bytes In-System Programmable Flash AT90PWM81 AT90PWM161

AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE

8-bit Microcontroller with 40K Bytes In-System Programmable Flash. ATmega406. Preliminary

More than Compatibility

AVR MICROCONTROLLER ARCHITECTURTE

Mohammad Shaffi 1, D Ravi Nayak 2. Dadi Institute of Engineering & Technology,

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad

8-bit Atmel Microcontroller with 64KB In-System Programmable Flash. ATmega64A

Microprocessors And Microcontrollers (Practical)

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

An Arduino Controlled 1 Hz to 60 MHz Signal Generator

INTERFACING HARDWARE WITH MICROCONTROLLER

AT90S Bit Microcontroller with 1K bytes Downloadable Flash AT90S1200. Features. Description. Pin Configuration

M32 Development Board

SECURE DIGITAL ACCESS SYSTEM USING IBUTTON

Building Interactive Devices and Objects. Prof. Dr. Michael Rohs, Dipl.-Inform. Sven Kratz MHCI Lab, LMU München

ATxmega64D3 Automotive

ATmega64A. Introduction. Features. 8-bit AVR Micrcontroller DATASHEET SUMMARY

The Atmel ATmega328P Microcontroller

8/16-bit Atmel AVR XMEGA Microcontrollers

8. Power Management and Sleep Modes

ATtiny4 / ATtiny5 / ATtiny9 / ATiny10. Introduction. Feature. Atmel 8-bit AVR Microcontroller with 512/1024 Bytes In-System Programmable Flash

8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

8/16-bit Atmel XMEGA A3U Microcontroller

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

MARCH ISSN: INTERNATIONALJOURNALFORENGINEERINGAPPLICATIONSAND TECHNOLOGY GPS ENABLED EMERGENT TRACING AND NEAREST FACILITY AVAILANCE SYSTEM

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

8/16-bit Atmel XMEGA B3 Microcontroller

DBAT90USB162 Atmel. DBAT90USB162 Enhanced Development Board User s Manual

The Atmel ATmega168A Microcontroller

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515

Mega128-DEVelopment Board Progressive Resources LLC 4105 Vincennes Road Indianapolis, IN (317) (317) FAX

8/16-bit Atmel XMEGA D4 Microcontroller

Product Change Notification

ATxmega384C3. 8/16-bit Atmel XMEGA C3 Microcontroller. Features

Doc: page 1 of 8

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

PB-MC-AVR28 28 Pin AVR Full Size Development Board

Transcription:

Lecture 14 AUTOMATIC CONTROL SYSTEMS Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Lecture 4 The AVR Microcontroller

Introduction to AVR CISC (Complex Instruction Set Computer) Put as many instruction as you can into the CPU RISC (Reduced Instruction Set Computer) Reduce the number of instructions, and use your facilities in a more proper way. RISC processors have a fixed instruction size. In AVR the instructions are 2 or 4 bytes. Reduce the number of instructions so higher speed. More than 95% of instructions are executed in 1 machine cycle. Use of high level language for programming.

AVR structure ALU SREG: I T H S V N Z C CPU PC Instruction decoder Instruction Register R0 R1 R2 R15 R16 R17 R30 R31 registers 4

AVR s CPU AVR s CPU ALU 32 General Purpose registers (R0 to R31) PC register Instruction decoder ALU SREG: I T H S V N Z C PC CPU Instruction decoder Instruction Register R0 R1 R2 R15 R16 R17 R30 R31 registers 5

Some simple instructions There are some instructions for loading values, doing arithmetic and logic operations; such as: LDI (Load Immediate), ADD, SUB, INC, DEC, AND, etc. LDI Rd, k % In high level language Rd = k ADD Rd,Rs % Rd = Rd + Rs SUB Rd,Rs % Rd = Rd Rs IVC Rd % Rd=Rd+1 DEC Rd %Rd=Rd-1 Write a program that calculates 19 + 95 LDI R16, 19 ;R16 = 19 LDI R20, 95 ;R20 = 95 ADD R16, R20 ;R16 = R16 + R20 ALU SREG: I T H S V N Z C CPU PC Instruction decoder Instruction Register R0 R1 R2 R15 R16 R17 R30 R31 registers

R0 through R15 Only registers in the range R16 to R31 can be loaded immediate. We cannot load a constant into the registers R0 to R15 directly. It would have to be loaded into a valid register first then copied. To load the value of 10 into register zero (R0): LDI R16,10 ;R16=10 MOV R0,R16 Copy contents of R16 to R0 ALU SREG: I T H S V N Z C PC CPU Instruction decoder Instruction Register R0 R1 R2 R15 R16 R17 R30 R31 registers

Status Register (SREG) The Status Register contains information about the result of the most recently executed arithmetic instruction. This information can be used for altering program flow in order to perform conditional operations. This will in many cases remove the need for using the dedicated compare instructions, resulting in faster and more compact code. SREG: Interrupt I Temporary ALU T Half carry SREG: I T H S V N Z C CPU PC Instruction decoder Instruction Register H S V N Z C Sign N+V overflow Negative R0 R1 R2 R15 R16 R17 R30 R31 registers Zero Carry

Status Register (SREG) SREG: I T H S V N Z C Bit 7(I): Global Interrupt Enable Bit 6(T): Bit Copy Storage Bit 5(H): Half Carry Flag Bit 4(S): Sign Bit, S = N V Bit 3(V): Two s Complement Overflow Flag Bit 2(N): Negative Flag Bit 1(Z): Zero Flag Bit 0(C): Carry Flag Interrupt Temporary Half carry ALU Sign N+V SREG: I T H S V N Z C CPU PC Instruction decoder Instruction Register overflow Negative R0 R1 R2 R15 R16 R17 R30 R31 registers Zero Carry

Addresses Register (SREG) ALU SREG: I T H S V N Z C CPU PC Instruction decoder Instruction Register R0 R1 R2 R15 R16 R17 R30 R31 registers

AVR different groups Classic AVR e.g. AT90S2313, AT90S4433 Mega e.g. ATmega8, ATmega32, ATmega128 Tiny e.g. ATtiny13, ATtiny25 Special Purpose AVR e.g. AT90PWM216,AT90USB1287

ATMEGA32 Features High-performance, Low-power Atmel AVR 8- bit Microcontroller 131 Powerful Instructions Most Single-clock Cycle Execution 32 8 General Purpose Working Registers 32Kbytes of In-System Self-programmable Flash program memory (W/E: 10,000 times) 1024Bytes EEPROM (W/E: 100,000 times) Data retention: 20 years at 85 C/100 years at 25 C Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface 12

ATMEGA32 Features Operating Voltages 2.7V - 5.5V for ATmega32L 4.5V - 5.5V for ATmega32 Speed Grades 0-8MHz for ATmega32L 0-16MHz for ATmega32 Power Consumption at 1MHz, 3V, 25 C Active: 1.1mA Idle Mode: 0.35mA Power-down Mode: < 1μA 13

ATMEGA32 Pin Configurations 14

ATMEGA32 Peripheral Features Two 8-bit Timer/Counters and one 16-bit Four PWM Channels 8-channel, 10-bit ADC Programmable Serial USART Programmable Watchdog Timer with Separate Onchip Oscillator On-chip Analog Comparator Internal Calibrated RC Oscillator External and Internal Interrupt Sources Six Sleep Modes: Idle, ADC Noise Reduction, Powersave, Power-down, Standby and Extended Standby 15

ATMEGA32 Pin Descriptions VCC GND Digital supply voltage. Ground. Port A (PA7..PA0) Port A is an 8-bit bi-directional I/O port. Port B (PB7..PB0) Port B is an 8-bit bi-directional I/O port. Port C (PC7..PC0) Port C is an 8-bit bi-directional I/O port. Port D (PD7..PD0) Port D is an 8-bit bi-directional I/O port. 16

ATMEGA32 Pin Descriptions RESET Reset Input. XTAL1 Input to the inverting Oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting Oscillator amplifier. AVCC AVCC is the supply voltage pin for Port A and the A/D Converter. AREF AREF is the analog reference pin for the A/D Converter. 17

ATMEGA32 Pin Descriptions Port A Pins Alternate Functions Chapter 4 ADC0-7 Port A serves as the analog inputs to the A/D Converter. 18

ATMEGA32 Pin Descriptions Chapter 4 Port B Pins Alternate Functions XCK/T0 T0 (Timer/Counter0 External Counter Input) XCK (USART External Clock Input/Output) T1 T1 (Timer/Counter1 External Counter Input) INT2/AINO AIN0 (Analog Comparator Positive Input) INT2 (External Interrupt 2 Input) 19

ATMEGA32 Pin Descriptions Port D Pins Alternate Functions Chapter 4 PD2 INT0 (External Interrupt 0 Input) PD3 INT1 (External Interrupt 1 Input) 20