AVR MICROCONTROLLER ARCHITECTURTE

Similar documents
ก AVR Microcontrollers

CN310 Microprocessor Systems Design

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

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

AVR ISA & AVR Programming (I)

Module 2: Introduction to AVR ATmega 32 Architecture

ATmega128. Introduction

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

By: Dr. Hamed Saghaei

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

AVR Microcontrollers Architecture

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

ECED3204: Microprocessor Part I--Introduction

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

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

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

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

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

Computer Hardware Requirements for ERTSs: Microprocessors & Microcontrollers

Lecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad

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

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

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

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

COMP2121: Microprocessors and Interfacing. Instruction Formats and Addressing Modes

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

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

Automation Engineers AB Pvt Ltd, NOIDA Job-Oriented Course on Embedded Microcontrollers & Related Software Stack

8051 microcontrollers

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

EE 308: Microcontrollers

CN310 Microprocessor Systems Design

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

Lecture 2. Introduction to Microcontrollers

EE 354 Fall 2015 Lecture 1 Architecture and Introduction

Chapter 4: Atmel s AVR 8-bit Microcontroller Part 1 Assembly Programming

Development Tools. 8-Bit Development Tools. Development Tools. AVR Development Tools

Computer Organization CS 206 T Lec# 2: Instruction Sets

Question Bank Microprocessor and Microcontroller

Microcontrollers. Microcontroller

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

Lecture 1. Course Overview and The 8051 Architecture

MicroProcessor. MicroProcessor. MicroProcessor. MicroProcessor

COMP3221: Microprocessors and Embedded Systems

Secure Microcontrollers for Smart Cards. AT90SC Summary

TYPES OF INTERRUPTS: -

DERTS Design Requirements (1): Microcontroller Architecture & Programming

Fig 1. Block diagram of a microcomputer

SOME ASSEMBLY REQUIRED

APPENDIX A FOR SKEE3732 LABORATORY 1 SHEET

Microcontroller systems Lec 2 PIC18LF8722 Microcontroller s s core

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

Department of Electronics and Instrumentation Engineering Question Bank

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

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

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software!

8-Bit Microcontroller with 2K Bytes of In-System Programmable Flash. AT90S2323 AT90LS2323 AT90S2343 AT90LS2343 Preliminary AT90S/LS2323.

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

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

Module 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function


acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.

UNIVERSITY OF MORATUWA CS2052 COMPUTER ARCHITECTURE. Time allowed: 2 Hours 10 min December 2018

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

MICROPROCESSOR BASED SYSTEM DESIGN

Computer Architecture

Microprocessors And Microcontroller

ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers. Eng. Salma Hesham

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

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

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

Instruction Sets: Characteristics and Functions Addressing Modes

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

Memory Architectures. Hongwei Zhang. Chapter 9

Diploma in Embedded Systems

SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET

AVR Logical and Bitwise Instructions

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

Chapter 3 : Control Unit

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27)

CN310 Microprocessor Systems Design

Chapter 7 Central Processor Unit (S08CPUV2)

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

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

Figure 1.1: Some embedded device. In this course we shall learn microcontroller and FPGA based embedded system.

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Introduction to Embedded Systems

Computer Organization and Technology Processor and System Structures

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

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Have difficulty identifying any products Not incorporating embedded processor FPGA or CPLD In one form or another

8051 Microcontroller

Introduction to Microcontrollers

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

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

Lecture (02) PIC16F84 (I)

EE 308: Microcontrollers

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss

Module I. Microcontroller can be classified on the basis of their bits processed like 8bit MC, 16bit MC.

Transcription:

AVR MICROCONTROLLER ARCHITECTURTE

AVR MICROCONTROLLER AVR- Advanced Virtual RISC. The founders are Alf Egil Bogen Vegard Wollan RISC AVR architecture was conceived by two students at Norwegian Institute of Technology (NTH) and further refined and developed at Atmel Norway, the Atmel company founded by the two chip architects. AVR Micro controllers is Family of RISC Microcontrollers from Atmel. There are multiple architectures 1.RISC (Reduced Instruction Set Computer) 2. CISC (Complex Instruction Set Computer)

RISC MICROCONTROLLER RISC-Reduced Introduction Set Computer Till 1980 Trend was to build increasingly complex CPUs with complex set of instructions like (CISC) Instruction execute in single cycle. Architecture which reduces the chip complexity by simpler processing instructions. RISC architecture CPUs capable of executing only a very limited (simple) set of instructions.

RISC MICROCONTROLLER Reduced Instruction Set Computers Advantages. Fast Execution of Instructions due to simple instructions for CPU. RISC chips require fewer transistors, which makes them cheaper to design and produce. Emphasis on software. Single-clock, reduced instruction only. Register to register: LOAD" and "STORE are independent instructions. Spends more transistors on memory registers.

AVR MICROCONTROLLER The AVR is a Harvard architecture CPU. Harvard Architecture Computer architectures that used physically separate storage and signal pathways for their instructions and data. CPU can read both an instruction and data from memory at the same time that makes it faster. von Neumann architecture CPU can Read an instruction or data from/to the memory. Read, Write can`t occur at the same time due to same memory and signal pathway for data and instructions.

AVR MICROCONTROLLER Harvard Architecture diagram

AVR MICROCONTROLLER A series of 8-bit RISC microcontrollers from Atmel. All AVR microcontrollers share same instruction set and a basic CPU (Harvard) architecture. It has 32 8-Bit general purpose registers. Mostly instruction Execute in Single clock cycle. Which makes it faster among 8 bit microcontrollers. AVR was designed for efficient execution of compiled C code.

AVR MICROCONTROLLER AVR is a family of 8-bit microcontrollers with a large range of variants differing in: - size of program-memory (flash) - size of EEPROM memory - number of I/O pins - number of on-chip features such as UART and ADC Smallest microcontroller is the ATTiny11 with 1k flash ROM, no RAM and 6 I/O pins. Large such as the ATMEGA128 with 128k flash, 4KB RAM, 53 I/O pins and lots of on-chip features.

AVR General Features The architecture of AVR makes it possible to use the storage area for constant data as well as instructions. Instructions are 16 or 32-bits Most are 16-bits and are executed in a single clock cycle. Each instruction contains an opcode Opcodes generally are located in the initial bits of an instruction

AVR ARCHITECHTURE

AVR General Features RISC architecture with mostly fixed-length instruction, load-store memory access and 32 general-purpose registers. A two-stage instruction pipeline that speeds up execution Majority of instructions take one clock cycle Up to 16-MHz clock operation Up to 12 times performance speedup over conventional CISC controllers. Wide operating voltage from 2.7V to 6.0V Simple architecture offers a small learning curve to the uninitiated.

REGISTERS AVR CORE ARCHITECHTURE Two types of registers GENREL purpose & SPECIAL purpose registers GENREL purpose 32 general purpose registers having storage capacity of 8-Bits Named as R0,R1,R2 to R31. Register 0 to 15 & 16 to 31 are different. Can store both Data & Addresses. SPECIAL purpose: Three registers Program counter Stack Pointer Status Register

Interrupt A condition or event that interrupts the normal flow of control in a program Interrupt hardware inserts a function call between instructions to service the interrupt condition When the interrupt handler is finished, the normal program resumes execution Interrupts are generally classified as internal or external software or hardware An external interrupt is triggered by a device originating off-chip An internal interrupt is triggered by an on-chip component

AVR ARCHITECHTURE STATUS REGISTER (SREG) It is 8-bit long each bit has a different meaning. I T H S V N Z C I: Global Interrupt Enable/Disable Flag, SREG7 T: Transfer bit used by BLD and BST instructions, SREG6 H: Half Carry Flag, SREG5 S: For signed tests Instruction Set, SREG4 V: Two's complement overflow indicator, SREG3 N: Negative Flag, SREG2 Z: Zero Flag, SREG1 C: Carry Flag, SREG0

Timer/Counter The ATMega16 has three timer/counter devices on-chip Each timer/counter has a count register A clock signal can increment or decrement the counter Interrupts can be triggered by counter events External Clock Signal

AVR MEMORY ORGANIZATION AVR address Spaces Three address spaces Data memory Storing data to be processed Program memory Storing program and sometimes constants EEPROM memory Large permanent data storage

Memory: AVR MEMORY ORGANIZATION There are two separate memories Program Memory (Flask Memory) Data Memory

AVR MEMORY ORGANIZATION Program Memory (Flask Memory) 2K Bytes of flash memory 128 Bytes of In-System Programmable EEPROM program memory holds interrupt function addresses,16 bit and double word (32 bit) opcode, and static data tables

AVR MEMORY ORGANIZATION Data Memory Used for data and is separate from the program memory. 128 Bytes of SRAM Register reassigned the 32 Data Space addresses ($00 - $1F), I/O memory space contains 64 addresses for CPU peripheral functions such as control registers, Timer/Counters, A/D converters and other I/O functions. I/O memory can be accessed directly or as the Data Space locations those of the Register File, $20 - $5F. Stack is effectively allocated in the general data SRAM, and consequently the stack size is only limited by the total SRAM size and the usage of the SRAM.

AVR ADDRESSING MODES Register Direct, with 1 and 2 registers I/O Direct Data Direct Data Indirect with pre-decrement with post-increment Code Memory Addressing

Register Direct: 1 Register Examples: INC R16 CLR R22 EOR R0

Register Direct: 2 Registers Examples: ADD R16,R17 CP R22,R5 MOV R0, R1

I/O Direct Examples: IN R16,PIND OUT PORTC,R16

Examples: STS 0x1000,R16 Data Direct

Data Indirect Examples: LD R16, Y ST Z, R16

Data Indirect w/ Displacement Examples: LDD R16, Y+0x10 STD Z+0x20, R16

Data Indirect: Pre-Decrement Examples: LD R16, -Z ST -Z, R16

Data Indirect: Post-Increment Examples: LD R16, Z+ ST Z+, R16

Examples: LPM Program Memory Addressing

Examples: IJMP ICALL Indirect Program Addressing

Examples: RJMP RCALL Relative Program Addressing

AVR Instruction Set The types of AVR Instructions are i) Arithmetic and Logic Instructions ii) Branch and Jump Instructions iii) Data Movement Instructions iv) Bit Manipulation and Bit Test Instruction

AVR Instructions

Arithmetic and Logical Instructions Addition Subtraction Logical AND Logical OR Exclusive OR One s Complement Two s Complement Increment/Decrement Set/Clear Registers and Bits in Registers

Branch Instructions RJMP/RCALL Relative Jump (+/-k) IJMP/ICALL Indirect Jump (Z Reg) RET/RETI Return from call/interrupt CP* - Compare SB* - Skip if Bit in Register or I/O is set/clr BR* - Branch if condition is met

Bit manipulation and Bit test Instructions SBI/CBI Set / Clear Bit in register LSL/LSR Logical Shift Left / Right ROL/ROR Rotate Left / Right (thru Carry bit) ASR Arithmetic Shift Right SWAP Swap Nibbles BST/BLD Bit Store / Load BSET/BCLR Set / Clear Status Bits by number SE*/CL* - Set / Clear Status Bits by name

Bit manipulation and Bit test Instructions SBI/CBI Set / Clear Bit in register LSL/LSR Logical Shift Left / Right ROL/ROR Rotate Left / Right (thru Carry bit) ASR Arithmetic Shift Right SWAP Swap Nibbles BST/BLD Bit Store / Load BSET/BCLR Set / Clear Status Bits by number SE*/CL* - Set / Clear Status Bits by name

Other Instructions NOP Do nothing for 1 cycle SLEEP Sleep until reset or interrupted WDR Watch Dog Reset

Assembly language and C Programming Code using keywords that are easy to understand, use a software to convert keywords into binary instructions. Assembler Code in symbolic form, use a software to break symbolic instructions into actual instructions of uc Compiler & Linker OS

Development Tools The main AVR controller development tools are Code Assembler Code Simulator Evaluation Boards Emulator Device Programmer

Code Assembler An assembler takes a text file called the source file, with the mnemonic representation of the program (simply called the source code) and converts it into another file with the machine op-codes (simply called the machine code or object code). They Two types of Assembler used in AVR Controllers are i) AVR Family Assembler ii) IAR Assembler

Code Simulator A program that simulates or mimics the AVR controller is called a simulator. A simulator can execute the program code, one code at a time, displaying the result on the screen (contents of registers, ports, status, etc.),and this can help ensure that the program works as expected. The two types of Simulators used in AVR Controllers are i) AVR Simulator ii) AVR Studio

Evaluation Boards An evaluation board you can quickly test your programs before committing a final design board. Evaluation boards have a communication link to the PC for downloading your program to the target processor. AVR controllers can be programmed without the need for a special programmer, the downloaded program is programmed into the target controller program memory by the evaluation board and then executed. The evaluation boards can be used not only for testing your programs, but also as a simple device programmer.

Evaluation Boards The Popular evaluation boards used with AVR controllers are: ATMEL AVR MCU00100 Development board STK200 Board STK 300 Board

Cross Compiler A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. A cross compiler is necessary to compile for multiple platforms from one machine. A platform could be infeasible for a compiler to run on, such as for the microcontroller of an embedded system because those systems contain no operating system. In paravirtualization one machine runs many operating systems, and a cross compiler could generate an executable for each of them from one main source.

Hardware issues in AVR The major hardware issues in AVR microcontroller are: Power source Operating Clock Sources Reset Circuit

Power Source The power source for running a processor system is a critical component. No system would run without a power supply. There are various options that the designer may consider, depending upon the application. Broadly, the choice would be dictated by whether the system is portable and hence must use a battery source or whether it is for a desktop application, where an AC power line could be used. Sometimes you may have access to an AC power line, but the battery operation may seem more convenient simply because it offers added portability and does not require a bulky transformer and associated rectifier, filter, and regulator components.

Power Source Battery Power i) Primary Batteries ii) Secondary Batteries Main Operating Supply Power from port signal lines Voltage Regulators

Operating Clock Source Providing a clock source to the AVR processor is another important design process Processor clock frequency determines the rate at which the programs will execute. In AVR, most instructions execute in one clock cycle, some take two clocks, and for some high-end AVR processors, a few instructions also take four or five clock cycles. The AVR processor clock can be operated with a variety of components. Some of the clock source methods are: Using a Crystal Clock IC Using a Ceramic resonator Using a quartz crystal Using a quartz clock crystal Using internal RC clock Oscillator

Reset Circuit CPUs require a reset pulse after the power supply has stabilized. The basic requirement is that a processor reset pulse should appear after the power supply has settled to a stable value. The processor has a power-on reset circuit as well as an external reset input circuit. The power-on reset circuit activates when the power supply voltage is below a certain threshold. After some timeout period (called power-on reset period), the processor starts executing program memory code.

Reset Circuit The simplest reset circuit using just a capacitor and a shunt switch for external reset. The reset pin of the AVR processor has an internal resistor of about 100- KΩ value between the reset pin and the Vcc supply voltage pin, and so any external resistor is not required. The capacitor is required to debounce the switch when it is pressed and released.