EE 308: Microcontrollers

Similar documents
EE 308: Microcontrollers

EE 308: Microcontrollers

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

ECED3204: Microprocessor Part I--Introduction

Computer Organization and Assembly Language (CS-506)

Introduction to Embedded Systems and Chapter 1: Introduction to HCS12/MC9S12. EE383: Introduction to Embedded Systems University of Kentucky

AVR Microcontrollers Architecture

Microcontrollers. Microcontroller

MICROPROCESSOR BASED SYSTEM DESIGN

Microcomputer Architecture and Programming

Microcontroller Systems. ELET 3232 Topic 11: General Memory Interfacing


Microprocessors/Microcontrollers

COMP2121: Microprocessors and Interfacing. Introduction to Microprocessors

EE 308: Microcontrollers

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

Introduction to general architectures of 8 and 16 bit micro-processor and micro-controllers

Grundlagen Microcontroller Memory. Günther Gridling Bettina Weiss

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422)

EE 308: Microcontrollers

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

COMP3221: Microprocessors and. and Embedded Systems. Overview. Lecture 23: Memory Systems (I)

MEMORY BHARAT SCHOOL OF BANKING- VELLORE

Read and Write Cycles

M. Sc (CS) (II Semester) Examination, Subject: Computer System Architecture Paper Code: M.Sc-CS-203. Time: Three Hours] [Maximum Marks: 60

ARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview

Memory Overview. Overview - Memory Types 2/17/16. Curtis Nelson Walla Walla University

EE 308: Microcontrollers

Module 2: Introduction to AVR ATmega 32 Architecture

MicroProcessor. MicroProcessor. MicroProcessor. MicroProcessor

ECSE-2610 Computer Components & Operations (COCO)

Chapter 5 Internal Memory

Lecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Microcontroller systems Lec 2 PIC18LF8722 Microcontroller s s core

Electronic Control systems are also: Members of the Mechatronic Systems. Control System Implementation. Printed Circuit Boards (PCBs) - #1

Computer Memory. Textbook: Chapter 1

Basic Organization Memory Cell Operation. CSCI 4717 Computer Architecture. ROM Uses. Random Access Memory. Semiconductor Memory Types

SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET

Memory & Simple I/O Interfacing

Control System Implementation

EE 308: Microcontrollers

PIC Microcontroller and

8051 INTERFACING TO EXTERNAL MEMORY

CPEG300 Embedded System Design. Lecture 3 Memory

ATmega128. Introduction

Concept of Memory. The memory of computer is broadly categories into two categories:

Chapter TEN. Memory and Memory Interfacing

COA. Prepared By: Dhaval R. Patel Page 1. Q.1 Define MBR.

Address connections Data connections Selection connections

Memory Expansion. Lecture Embedded Systems

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

ELCT 912: Advanced Embedded Systems

Semiconductor Memories: RAMs and ROMs

Main Memory (RAM) Organisation

William Stallings Computer Organization and Architecture 6th Edition. Chapter 5 Internal Memory

Computer Organization. 8th Edition. Chapter 5 Internal Memory

Overview of Microcontroller and Embedded Systems

Organization. 5.1 Semiconductor Main Memory. William Stallings Computer Organization and Architecture 6th Edition

Microprocessor and Microcontroller question bank. 1 Distinguish between microprocessor and microcontroller.

CN310 Microprocessor Systems Design

Lecture-7 Characteristics of Memory: In the broad sense, a microcomputer memory system can be logically divided into three groups: 1) Processor

THE MICROCOMPUTER SYSTEM CHAPTER - 2

Unit 6 1.Random Access Memory (RAM) Chapter 3 Combinational Logic Design 2.Programmable Logic

EE 354 Fall 2015 Lecture 1 Architecture and Introduction

Memory classification:- Topics covered:- types,organization and working

Read Only Memory ROM

Computer Organization and Microprocessors SYLLABUS CHAPTER - 1 : BASIC STRUCTURE OF COMPUTERS CHAPTER - 3 : THE MEMORY SYSTEM

Allmost all systems contain two main types of memory :

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

Interface DAC to a PC. Control Word of MC1480 DAC (or DAC 808) 8255 Design Example. Engineering 4862 Microprocessors

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

Wed. Aug 23 Announcements

Logic and Computer Design Fundamentals. Chapter 8 Memory Basics

UNIT:4 MEMORY ORGANIZATION

CS 320 February 2, 2018 Ch 5 Memory

Lecture (01) Introducing Embedded Systems and the Microcontrollers By: Dr. Ahmed ElShafee

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

3 Computer Architecture and Assembly Language

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

Module 5a: Introduction To Memory System (MAIN MEMORY)

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

V8-uRISC 8-bit RISC Microprocessor AllianceCORE Facts Core Specifics VAutomation, Inc. Supported Devices/Resources Remaining I/O CLBs

HCS12 Microcontroller and Embedded Systems: Using Assembly and C with CodeWarrior 1 st Edition

5 Computer Organization

Computer Hardware Requirements for ERTSs: Microprocessors & Microcontrollers

Internal Memory. Computer Architecture. Outline. Memory Hierarchy. Semiconductor Memory Types. Copyright 2000 N. AYDIN. All rights reserved.

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Chapter 2 Sections 1 8 Dr. Iyad Jafar

Microprocessors and Microcontrollers. Assignment 1:

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

Chapter 1: Basics of Microprocessor [08 M]

Memory Study Material

The Central Processing Unit

Memory memories memory

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

THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS. Using Assembly and С

TKT-3500 Microcontroller systems

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

Large and Fast: Exploiting Memory Hierarchy

Digital Systems. Semiconductor memories. Departamentul de Bazele Electronicii

Transcription:

EE 308: Microcontrollers AVR Architecture Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA January 23, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 1 / 23

Harvard Architecture overview data bus data bus Code memory control bus CPU control bus Data memory address bus Harvard architecture address bus Separate buses for accessing code and data Faster Less delays Requires more hardware Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 2 / 23

Data, address and control lines Data lines carry information in and out of the CPU. More lines results in faster data transfer but more complex and more expensive. Address lines identifies the devices and memory to be connected to the CPU Control lines control devices signals for read/write as directed by the CPU Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 3 / 23

Data bus Carries data to and from RAM, ROM, and other devices More data lines facilitates more data being transferred at a time but results in more complex and expensive CPU Data buses are bidirectional Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 4 / 23

Address bus Number of address lines determines the number of locations that can be addressed Address buses are unidirectional For n lines there are 2 n locations (e.g., memory) that can be addressed For example, 16 address lines can provide 2 16 = 65, 536 addressable memory, i.e., 64KB? Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 5 / 23

Address bus Number of address lines determines the number of locations that can be addressed Address buses are unidirectional For n lines there are 2 n locations (e.g., memory) that can be addressed For example, 16 address lines can provide 2 16 = 65, 536 addressable memory, i.e., 64KB? 1KB = 1024 Bytes Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 5 / 23

Control bus Select operations of the Arithmetic Control Unit (ALU) Selects read/write for the memory Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 6 / 23

Types of memory Register file: embedded in the CPU for fast operations Code memory: ROM typically flash Data memory: RAM typically SRAM Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 7 / 23

Classification of memory 1 Volatile Content is lost when power is switched off Known as RAM (Random Access Memory) Could be static (SRAM) or dynamic (DRAM) 2 Non-Volatile Retains content even when no power is provided Known as ROM (Read Only Memory) Different types: ROM, PROM, EPROM, EEPROM, FLASH Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 8 / 23

SRAM Made of flipflops Requires 6 transistors each Each cell holds only 1 bit Using address decoders, how many address lines are needed to address 16Kbits memory? D in R/W CS SRAM Memory Cell D out Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 9 / 23

DRAM Requires only one transistor per bit Information is stored in a capacitor Less silicon area is needed Can achieve more memory per a given area Needs refreshing due to leakage Slower than SRAM but cheaper Uses multiplexers/demultiplexers to cut the required address lines in half Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 10 / 23

Non-volatile memory Read Only Memory (ROM): Can t be overwritten, function determined by manufacturer, common type is Mask-ROM (MROM). Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 11 / 23

Non-volatile memory Read Only Memory (ROM): Can t be overwritten, function determined by manufacturer, common type is Mask-ROM (MROM). Programmable ROM (PROM): Matrix is memory with intact fuse and default value of 1. Short high current pulse is applied to selected cells destroying the fuse and the logical value for those cells become 0. Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 11 / 23

Non-volatile memory Read Only Memory (ROM): Can t be overwritten, function determined by manufacturer, common type is Mask-ROM (MROM). Programmable ROM (PROM): Matrix is memory with intact fuse and default value of 1. Short high current pulse is applied to selected cells destroying the fuse and the logical value for those cells become 0. Erasable PROM (EPROM): Programmed by physical process called avalanche injection. Can be erased by exposing the chip to UV for about 30 min. Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 11 / 23

Non-volatile memory Read Only Memory (ROM): Can t be overwritten, function determined by manufacturer, common type is Mask-ROM (MROM). Programmable ROM (PROM): Matrix is memory with intact fuse and default value of 1. Short high current pulse is applied to selected cells destroying the fuse and the logical value for those cells become 0. Erasable PROM (EPROM): Programmed by physical process called avalanche injection. Can be erased by exposing the chip to UV for about 30 min. Electrically EPROM (EEPROM): Similar to EPROM but has charge pumps provided on the chip instead of UV. Good for about 100,000 cycles. Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 11 / 23

Non-volatile memory Read Only Memory (ROM): Can t be overwritten, function determined by manufacturer, common type is Mask-ROM (MROM). Programmable ROM (PROM): Matrix is memory with intact fuse and default value of 1. Short high current pulse is applied to selected cells destroying the fuse and the logical value for those cells become 0. Erasable PROM (EPROM): Programmed by physical process called avalanche injection. Can be erased by exposing the chip to UV for about 30 min. Electrically EPROM (EEPROM): Similar to EPROM but has charge pumps provided on the chip instead of UV. Good for about 100,000 cycles. Flash: Similar to EEROM but memory is erased in blocks. Used for storing code. It is cheaper but good for around 10,000 cycles. Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 11 / 23

Memory mapping Separate memory addressing: need to address each memory, SRAM, FLASH, or EEPROM separately Single memory range: map different memory into a single memory range Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 12 / 23

Little endian vs. big endian Given a 16-bit value, for example 0xB60F, it is desired to save it into memory location 0x100 one byte at a time which byte gets written in the high byte and which one gets written in the low byte Little endian: used by most microcontrollers including AVR and Intel microprocessors 0x100 Big endian: used by Freescale High Byte B6 Low Byte 0F 0x100 High Byte 0F Low Byte B6 Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 13 / 23

Addressing modes Immediate (single-register): operand is a register and may have a constant value as a second operand, e.g., NEG R18 ;negate the content of R18 LDI R19,0 x06 ;load 0x06 into R19 Register: two registers hold the data to be manipulated ADD R20, R23 ;add R23 to R20 and store the result in R20 Direct: operand is a memory location LDS R19,0 x560 ;load R19 with the content of mem loc 0x560 STS 0x40, R19 ;store R19 to data space location 0x40 Register indirect: operand is a register but in points to the memory location LDI XL,0 x30 ;load R26 (low byte of X) with 0x30 LDI XH,0 x01 ;load R27 (high byte of X) with 0x01 LD R18,X ;load R18 with content of memory 0x130 Auto-increment/auto-decrement: content of register is pre- or post- incremented/decremented after/before memory access LD Rn,X+ ;load Rn with content pointed to by X then inc X LD Rn,-X ;decrement X then load Rn by contented pointed to by new X Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 14 / 23

Arithmetic Logic Unit (ALU) A[n 1 : 0] B[n 1 : 0] Takes two inputs Status Performs arithmetic and logic operations Op Code ALU Status Result Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 15 / 23

Status register 8-bit register used by the ALU to indicate arithmetic conditions Global Interrupt Enable Bit Copy Storage Half Carry Sign Flag Overflow Flag Negative Flag Zero Flag Carry Flag Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 16 / 23

Control unit, program counter, stack and stack pointer Control unit: controls devices, data path and determines which instruction to be executed Program counter: address of the next instruction to be executed Stack: memory used by the CPU to keep track of return addresses and register contents when branching, servicing an interrupt or executing a subroutine Stack pointer: points to the current position in the stack Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 17 / 23

AVR core RISC with Harvard architecture Code ROM Data RAM Data EEPROM Timers I/O ports ADC PWM Communication interfaces: USART, SPI, I2C (TWI), CAN, USB Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 18 / 23

General purpose registers Register provide fast method for processing The registers are 8-bit wide Most operations can be executed in one cycle Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 19 / 23

Some key specifics Instructions are either 2-bytes or 4-bytes Data lines to the data memory are 8-bit Data lines to the program memory are 16-bit Stack pointer is 16-bit Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 20 / 23

Memory map Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 21 / 23

I/O space I/Os and peripherals are placed in I/O space I/O addresses are offset from memory address by 0x20 I/O registers in the range 0x00 to 0x1F are directly bit accessible IN and OUT commands must use addresses in the range 0x00 to 0x3F When using LD and ST commands I/O registers are addressed as data space and therefore 0x20 must be added to their addresses Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 22 / 23

Atmega1284 RISC architecture 131 instructions (most executes in single clock cycle) 128K bytes code ROM 4K bytes EEPROM 16K bytes SRAM JTAG Timers/counters, PWM, 8-channel 10bit ADC Watchdog timer USART, SPI, I2C Aly El-Osery (NMT) EE 308: Microcontrollers January 23, 2018 23 / 23