Wed. Aug 23 Announcements

Similar documents
Microcontrollers. Microcontroller

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Mark II Aiken Relay Calculator

Chapter 7 Central Processor Unit (S08CPUV2)

538 Lecture Notes Week 5

538 Lecture Notes Week 5

ME 4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 6


EE 308: Microcontrollers

Fredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт.

ME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7

Processing Unit CS206T

S12CPUV2. Reference Manual HCS12. Microcontrollers. S12CPUV2/D Rev. 0 7/2003 MOTOROLA.COM/SEMICONDUCTORS

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

CS/ECE 5780/6780: Embedded System Design

EE4390 Microprocessors. Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System

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

EE 354 Fall 2015 Lecture 1 Architecture and Introduction

EE319 K Lecture 3. Introduction to the 9S12 Lab 1 Discussion Using the TExaS simulator. University of Texas ECE

MOXSYN. General Description. Features. Symbol

ECE 372 Microcontroller Design Basic Assembly Programming. ECE 372 Microcontroller Design Basic Assembly Programming

AVR Microcontrollers Architecture

Introduction to Computers - Chapter 4

CPU Structure and Function

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

History of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram

ECE 3120 Lab 1 Code Entry, Assembly, and Execution

Microcontrollers and the Freescale/Motorola HC11

Chapter 4. MARIE: An Introduction to a Simple Computer

ARM Cortex-M4 Programming Model

ECE 471 Embedded Systems Lecture 2

ECE 4510/5530 Microcontroller Applications Chapter 1

Roberto Muscedere Images and Text Portions 2003 Prentice Hall 1

Microcomputer Architecture and Programming

Microcontrollers. 2IN60: Real-time Architectures (for automotive systems) Mike Holenderski,

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

Introduction to Microcontrollers

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

MARIE: An Introduction to a Simple Computer

COMPUTER ORGANIZATION AND ARCHITECTURE

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

HC11 Instruction Set

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

ARM Architecture and Assembly Programming Intro

Microprocessors. Microprocessors and rpeanut. Memory. Eric McCreath

Microprocessors and rpeanut. Eric McCreath

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

AVR ISA & AVR Programming (I)

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

Introduction to the MC9S12 Hardware Subsystems

MICROPROCESSOR BASED SYSTEM DESIGN

Instruction Set Architectures. CS301 Prof. Szajda

Chapter 4. Chapter 4 Objectives. MARIE: An Introduction to a Simple Computer

Getting Started with the HCS12 IDE

CN310 Microprocessor Systems Design

CPE300: Digital System Architecture and Design

ELCT 912: Advanced Embedded Systems

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

MARIE: An Introduction to a Simple Computer

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

ECE 571 Advanced Microprocessor-Based Design Lecture 3

Exam I Review February 2017

COS 140: Foundations of Computer Science

Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my...

Design of Embedded Systems Using 68HC12/11 Microcontrollers

EEL 4744C: Microprocessor Applications. Lecture 7. Part 2. M68HC12 Interrupt. Dr. Tao Li 1

CN310 Microprocessor Systems Design

QUESTION BANK CS2252 MICROPROCESSOR AND MICROCONTROLLERS

Chapter 4. Chapter 4 Objectives

Introduction to Microcontrollers

Computer Organisation CS303

Segment 1A. Introduction to Microcomputer and Microprocessor

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY COMMUNICATION ENGINEERING REG 2008 TWO MARKS QUESTION AND ANSWERS

ECE 372 Microcontroller Design Parallel IO Ports - Interrupts. ECE 372 Microcontroller Design Parallel IO Ports - Interrupts

Introduction to Microprocessor

Lecture 4: Instruction Set Architecture

General Purpose Processors

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

3.1 Description of Microprocessor. 3.2 History of Microprocessor

Instruction Sets: Characteristics and Functions Addressing Modes

OUTLINE. STM32F0 Architecture Overview STM32F0 Core Motivation for RISC and Pipelining Cortex-M0 Programming Model Toolchain and Project Structure

E3940 Microprocessor Systems Laboratory. Introduction to the Z80

CPU Structure and Function. Chapter 12, William Stallings Computer Organization and Architecture 7 th Edition

HC12 Built-In Hardware

b. List different system buses of 8085 microprocessor and give function of each bus. (8) Answer:

Laboratory: Introduction to Mechatronics. Instructor TA: Edgar Martinez Soberanes Lab 2. PIC and Programming

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

CPU Structure and Function

CodeWarrior. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Instruction Sets: Characteristics and Functions

Computer Organization and Technology Processor and System Structures

Wed. Sept 6 Announcements

ECE2049 E17 Lecture 4 MSP430 Architecture & Intro to Digital I/O

William Stallings Computer Organization and Architecture. Chapter 11 CPU Structure and Function

CPU12 REFERENCE MANUAL

7. Discuss the hardware signals and superscalar architecture of Pentium BTL 2 Understand

Question Bank Microprocessor and Microcontroller

17. Instruction Sets: Characteristics and Functions

Universität Dortmund. ARM Architecture

Transcription:

Wed. Aug 23 Announcements Professor Office Hours 1:30 to 2:30 Wed/Fri EE 326A You should all be signed up for piazza Most labs done individually (if not called out in the doc) Make sure to register your clicker on blackboard We will have some questions Friday will count for nothing, but can you can use them to verify that everything is registered. Real labs start next week Intro to tools/assembly Start looking at HW (some formatting issues will be fixed today)

Module 1 Microcontroller Programming Techniques Tim Rogers 2017

Learning Outcome #1 An ability to program a microcontroller to perform various tasks Why? IoT Embedded systems in cars

Learning Outcome #1 An ability to program a microcontroller to perform various tasks How? A. Architecture and Programming Model B. Instruction Set Overview C. Assembly Control Structures D. Control Structure Applications E. Table Lookup F. Parameter Passing G. Macros and Structured Programming

What makes a Microcontroller? General Purpose Focus on Programmability IBM Power 8 Microprocessor Embedded Whole-System Non-UserProgrammable

Different Objectives General Purpose High-performance Need to run anything relatively well Less energy constrained Limitless Memory Silicon devoted to compute and caches Embedded Limited ability Inexpensive Limited memory Low-energy Silicon devoted to many peripherals (although core still consumes a lot)

Characteristics of general-purpose processors Virtual memory (Page Tables, TLBs) Deep cache hierarchy Large number of registers Hardware floating point Deep Pipelines/ Out of Order Exec. Complex Prediction Mechanisms Multicore Take ECE 437! Interrupts mostly get in the way

Characteristics of embedded processors Live and die by interrupts! Few registers (need to switch contexts fast) Circuitry devoted to analog Often rely on hand-tuned assembly code

Instruction Set Architectures (ISAs) Set of operations visible to the programmer ISA is the contract between the SW and HW Examples: CPU12, x86, PowerPC, ARM, SPARC, etc

Different Types of ISAs CISC (Complex Instruction Set Computer) RISC (Reduced Instruction Set Computer) DSPs (Digital Signal Processors) 9S12 (ECE 362) 16-bits

ISA defines Interaction between processor and memory??

Some common Architectures How to compute Z = X + Y : Accumulator LoadA X AddA Y StoreA Z Reg/Reg Load R1,X Load R2,Y Add R3,R1,R2 Store R3,Z 9S12 (ECE 362)

Why Freescale 68HC(s)12?? (AKA 9S12) Relatively Simple Introduces basic instruction set concepts Can easily analyze memory bus timing Actually used in the real world Comes from the automotive industry

You Dev Kit Boot/Run Switch BDM connector 9S12C32 Switch / LED input/output COM port Microcontroller Module D.C. power Docking Board

Overview of 9S12C32 15

Overview of 9S12C32 Several things to note.. The HCS12 CPU has the same architecture and programming model as the HC12 16

Overview of 9S12C32 Several things to note.. The 9S12C32 module has 2K of SRAM and 32K of Flash (no EEROM) 17

Overview of 9S12C32 Several things to note.. The 48-pin version of the chip on this module does not have Ports A & B padded out 18

Overview of 9S12C32 Several things to note.. External interrupt pins are on Port E 19

Overview of 9S12C32 Several things to note.. Real-time interrupt (RTI) module 20

Overview of 9S12C32 Several things to note.. Analog-to-digital (ATD) converter module inputs are on Port PAD 21

Overview of 9S12C32 Several things to note.. Timer (TIM) module I/O on Port T 22

Overview of 9S12C32 Several things to note.. Pulse width modulator (PWM) here, I/O shared with TIM module on Port T MODRR register setting determines whether these Port T pins are mapped to the TIM or PWM 23

Overview of 9S12C32 Several things to note.. Asynchronous serial communications interface (SCI) on Port S 24

Overview of 9S12C32 Several things to note.. Controller area network (MSCAN) on Port M 25

Overview of 9S12C32 Several things to note.. Synchronous peripheral interface (SPI) on Port M 26

Memory Uses SRAM (Static Random Access Memory) Volatile Variables Stack Buffers Test Code Flash Memory Non-Volatile App Code Static Data Vectors (reset and interrupts)

9S12C32 Memory Map 2K SRAM (mappable) test code, data, variables, stack Default (reset) location is 800-FFF firmware (application code) 30K Flash 8000-F7FF interrupt vectors 28

Overview of 68HC(S)12 Architecture 29

9S12 Registers 8-bits Programming Model 16-bits D 8-bits 7 A 0 7 B 0 Accumulators Arithmetic/Logic X 15 0 Y 15 0 SP 15 0 PC 16-bits 16-bits 16-bits 16-bits 15 0 Index Registers Stack Pointer Program Counter Pointers to memory Can add constant/register Auto +/- Pointer to top of stack PSH/PUL Instructions Pointer to next instruction 30

Condition Code Register 7 6 5 4 3 2 1 0 S X H I N Z V C Condition Code Register (CCR) Carry/Borrow Flag Overflow Flag Zero Flag Negative Flag IRQ Mask Half-Carry XIRQ Mask Stop Disable

ALU Condition Codes C carry/borrow flag (carry out of the sign position for addition, complement of carry out of sign position for subtraction) V overflow flag (set if two s complement overflow has occurred) Z zero flag (set if result of computation is zero) N negative flag (most significant bit (sign) of computation) H half carry flag (carry out of the lower 4-bits (nibble), only valid after ADD) 32

Machine Control Condition Codes I IRQ interrupt mask Ø 0 IRQ is not masked (enabled) Ø 1 IRQ is masked (disabled) X XIRQ interrupt mask Ø 0 XIRQ is not masked (enabled) Ø 1 XIRQ is masked (disabled) S STOP instruction disable Ø 0 STOP instruction is enabled Ø 1 STOP instruction is disabled 33

Instruction Representation Just a bunch of bits Remember? Simple Computer?

Instruction Formats and Data Types Example BRSET oprx16,xysp, msk8, rel8 Opcode (1B) Postbyte Offset (2B) can also be 1B Immediate (2B) can also be 1B ADDA addr DAA Opcode (1B) opcode (2B) Postbyte *There are different ways to mix/match these DEX Opcode (1B) Length: 1B to 6B 35

Instruction Formats and Data Types Bit Byte (8-bit) Word (16-bit) Double Word (32-bit) Packed Binary Coded Decimal Unsigned Fractions

Addressing Modes Purpose: Need to access memory Need an ADDRESS?? ADDA addr Memory Addr Value 0 1 2 255 0 270 Value not possible 65535 69

Addressing Modes Definition: The CPU uses an addressing mode to determine the effective address of where an operand is stored in memory Commonly used addressing modes Ø immediate (data immediately follows opcode, i.e., is part of the instruction) DOES NOT GO TO MEMORY Ø extended / absolute (absolute address of where operand is stored in memory) Ø relative (desired location is calculated relative to the current value in the PC) Ø indexed (an index register is used to point to the operand many variations with offset) Ø indirect (the operand pointer is in memory) 38

Illustrative Instructions LDAA addr STAA addr load accumulator A with the contents of memory location addr store the contents of accumulator A at memory location addr addr represents the effective address 39

LD versus Store Core Registers 77 A 56 B LDAA 1 Memory Addr 0 1 Value 255 0 65535 69