Chapter 1 Introduction to HCS12/MC9S12. Computer Hardware Organization What is a Computer? Software Hardware.

Slides:



Advertisements
Similar presentations
Microprocessors and Interfacing
Advertisements

H. Huang Transparency No.1-1 The HCS12/MC9S12 Microcontroller Copyright © 2010 Delmar Cengage Learning HCS12 Instruction Examples The LOAD and STORE Instructions.
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions  Read Almy, Chapters 5 and 6.  Homework #3 and Lab #3 due next week.  Quiz next.
EEE226 MICROPROCESSORBY DR. ZAINI ABDUL HALIM School of Electrical & Electronic Engineering USM.
EET 2261 Unit 5 Tables; Decision Trees & Logic Instructions
The 68HC11 Microcontroller Minnesota State University, Mankato
H. Huang Transparency No.1-1 The 68HC11 Microcontroller Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
TK 2633 Microprocessor & Interfacing
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Introduction to Microprocessors Number Systems and Conversions No /6/00 Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
EET 2261 Unit 2 HCS12 Architecture
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
Microcontroller based system design
Chapter 17 Microprocessor Fundamentals William Kleitz Digital Electronics with VHDL, Quartus® II Version Copyright ©2006 by Pearson Education, Inc. Upper.
UNDERSTANDING ASSEMBLY LANGUAGE.
Lecture 18 Last Lecture Today’s Topic Instruction formats
Atmega32 Architectural Overview
Computer Systems 1 Fundamentals of Computing Von Neumann & Fetch Execute Cycle.
Lecture#14. Last Lecture Summary Memory Address, size What memory stores OS, Application programs, Data, Instructions Types of Memory Non Volatile and.
Introduction to Computing: Lecture 4
Revised: Aug 1, ECE 263 Embedded System Design Lesson 1 68HC12 Overview.
Physics 413 Chapter 1: Introduction to the HCS 12 Microcontroller.
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
EECC250 - Shaaban #1 Lec # 20 Winter Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:
Execution of an instruction
SKILL AREA: 1.2 MAIN ELEMENTS OF A PERSONAL COMPUTER.
ECE 265 – LECTURE 3 68HC11 Address Space, Memory, Registers, and data transfers 3/29/ ECE265.
Computer Organization & Assembly Language © by DR. M. Amer.
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
Computer Architecture Lecture 03 Fasih ur Rehman.
Computer Organization. The digital computer is a digital system that performs various computational tasks Digital computer use binary number system which.
1 Introduction to Microcontroller Microcontroller Fundamentals & Programming.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Computer operation is of how the different parts of a computer system work together to perform a task.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
Execution Architecture MTT CPU08 Core M CPU08 INTRODUCTION.
Assembly Language Programming of 8085 BY Prof. U. V. THETE Dept. of Computer Science YMA.
Architectural Considerations A Review of Some Architectural Concepts.
HCS12 ARCHITECTURE Razvan Bogdan Embedded Systems.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
Computer Organization Instructions Language of The Computer (MIPS) 2.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Internal Programming Architecture or Model
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
CS 1410 Intro to Computer Tecnology Computer Hardware1.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
EE345 Chapter 2 Lecture 3 April Instruction and addressing modes 1.Extended Addressing 2.Direct Addressing 3.Inherent Addressing 4.Immediate Addressing.
EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions
The HCS12 Microcontroller Minnesota State University, Mankato
Addressing Modes in Microprocessors
Atmega32 Architectural Overview
Control Unit Lecture 6.
Gunjeet Kaur Dronacharya Group of institutions
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
UNIT – Microcontroller.
Introduction to 8086 Microprocessor
Computer Organization & Assembly Language Chapter 3
Microcomputer Programming
Introduction to Microprocessors and Microcontrollers
EE Embedded Systems Fall 2015
ME4447/6405 Microprocessor Control of Manufacturing Systems and
Introduction to Micro Controllers & Embedded System Design
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Computer Operation 6/22/2019.
Presentation transcript:

Chapter 1 Introduction to HCS12/MC9S12

Computer Hardware Organization What is a Computer? Software Hardware

The Processor Registers – Storage locations in the processor Arithmetic logic unit Control unit – Program counter keeps track of the address of the next instruction to be executed. – Status register flags the instruction execution result. The microprocessor – A processor implemented on a very large scale integration (VLSI) chip – Peripheral chips are needed to construct a product The microcontroller – The processor and peripheral functions implemented on one VLSI chip

Features of the HCS12 Microcontroller 16-bit CPU 64 KB memory space (also supports expanded memory up to 1 MB through a 16-KB window) 0 KB to 4KB of EEPROM 2 KB to 14 KB of on-chip SRAM 32 KB to 512 KB flash memory Sophisticated timer functions that include: input capture, output compare, pulse accumulators, real-time interrupt, and COP timer Serial communication interfaces: SCI, SPI, CAN, BDLC Background debug mode (BDM) 10-bit A/D converter Instructions for supporting fuzzy logic function

Semiconductor Memory (1 of 2) Random-access memory (RAM): same amount of time is required to access any location on the same chip – Dynamic random-access memory (DRAM): periodic refresh is required to maintain the contents of a DRAM chip – Static random-access memory (SRAM): no periodic refresh is required Read-only memory (ROM): can only be read but not written by the processor – Mask-programmed read-only memory (MROM): programmed when being manufactured – Programmable read-only memory (PROM): is fuse-based, can be programmed by the end user by a burner.

Semiconductor Memory (2 of 2) Erasable programmable ROM (EPROM) – Electrically programmable many times – Erased by ultraviolet light (through a window) – Erasable in bulk (whole chip in one erasure operation) Electrically erasable programmable ROM (EEPROM) – Electrically programmable many times – Electrically erasable many times – Can be erased one location, one row, or whole chip in one operation Flash memory – Electrically programmable many times – Electrically erasable many times – Can only be erased in bulk or a sector at a time

Computer Software Computer programs are known as software. A program is a sequence of instructions. Machine instruction – A sequence of binary digits which can be executed by the processor : A  [A] + [B] : A  [A] : A  6 – Hard to understand, enter, debug, and maintain for human being

Assembly Language Defined by assembly instructions – An assembly instruction is a mnemonic representation of a machine instruction ABA: A  [A] + [B] DECA: A  [A] – 1 – Assembly programs must be translated into machine instructions before it can be executed -- translated by an assembler – There are two kinds of assemblers: native assembler and cross assembler. – Programmers need to work on the program logic at a very low level and cannot achieve high productivity.

High-level Language Syntax of a high-level language is similar to English. A translator is required to translate the program written in a high- level language -- done by a compiler. – There are two types of compilers: native compiler and cross compiler. High-level languages allow the user to work on the program logic at higher level and achieve higher productivity. Source code – A program written in assembly or high-level language Object code – The output of an assembler or compiler

line 1: 2: 3: 4: 5: 6: addr machine code = B BB 1001 BB A 1100 source code org$2000 ldaa$1000 adda$1001 adda$1002 staa$1100 end

Memory Addressing Memory consists of a sequence of directly addressable locations. – A location is referred to as an information unit. – A memory location can be used to store data, instruction, and the status of peripheral devices. – A memory location has two components: an address and its contents.

Data transfers between the CPU and the memory are done over the common buses: address bus and data bus. Notations: m[addr] represents the contents of a memory location, [reg] refers to the contents of a register. – For example, [$20] refers to the contents of memory location at $20. – [A] refers to the contents of accumulator A.

Addressing Modes A HCS12 instruction consists of one or two bytes of opcode and zero to five bytes of operand addressing information. – Opcode bytes specify the operation to be performed by the CPU. – The first byte of a two-byte opcode is always $18. Addressing modes specify the operand to be operated on. The addressing mode may specify a value, a register, or a memory location to be used as an operand.

Inherent Mode Instructions that use this mode do not use extra bytes to specify operands because the instructions either do not need operands or all operands are CPU registers. – Operands are implied by the opcode. – Examples NOP INX DECA

Immediate Mode Operands for instructions that use immediate mode are included in the instruction. CPU does not access memory for operands. Example – LDAA #$55 – LDX #$1000

Direct Mode This mode can only specify memory locations in the range of This mode uses only one byte to specify the operand address. Example – LDAA$20 – LDAB$40

Extended Mode In this mode, the full 16-bit address is provided in the instruction. For example, – LDAA$4000 – LDX$FE60

Relative Mode (1 of 2) Used only by branch instructions Short and long conditional branch instructions use exclusively relative mode. BRCLR and BRSET instructions can also use relative mode to specify branch target. – A short branch instructions consists of an 8-bit opcode and a signed 8-bit offset. – The short relative mode can specify a range of -128 ~ – A long branch instruction consists of an 8-bit opcode and a signed 16-bit offset. – The range of the long relative mode is from ~ A programmer uses a symbol to specify the branch target and the assembler will figure out the actual branch offset (distance) from the instruction that follows branch instruction.

Relative Mode (2 of 2) For example, minus … bmiminus …

Indexed Mode This mode uses the sum of an index register (X, Y, PC, or SP) and an offset to specify the address of an operand. – The offset can be a 5-bit, 9-bit, and 16-bit signed value or the value in accumulator A, B, or D. – Automatic pre- or post-increment or pre- or post- decrement by -8 to +8 are options. – PC can be used as the index register for all but auto- increment or auto-decrement mode. – Indirect indexing with 16-bit offset or accumulator D as the offset is supported. A summary of indexed addressing modes is given in Table 1.3.

Indexed Addressing (1 of 2) 5-bit Constant Offset Indexed Addressing – The base index register can be X, Y, SP, or PC. – The range of the offset is from -16 to +15. – Examples ldaa 0,X stab -8,0 9-bit Constant Offset Indexed Addressing – The base index register can be X, Y, SP, or PC. – The range of the offset is from -256 to – Examples ldaa $FF,X ldab -20,Y

Indexed Addressing (2 of 2) 16-bit Constant Offset Indexed Addressing – The base index register can be X, Y, SP, or PC. – This mode allows access any location in the 64-KB range. – Examples ldaa 2000,X staa 4000,Y 16-bit Constant Indirect Indexed Addressing – A 16-bit offset is added to the base index register to form the address of a memory location that contains a pointer to the memory location affected by the instruction. – The square brackets distinguish this addressing mode from the 16-bit constant offset indexing. Example, – ldaa [10,X] – staa [20,Y]

Auto Pre/Post Decrement/Increment Indexed Addressing The base index register can be X, Y, or SP. The index register can be incremented or decremented by an integer value either before or after indexing taking place. The index register retains the changed value after indexing. The value to be incremented or decremented is in the ranges -8 thru -1 or 1 thru 8. The value needs to be related to the size of the operand or the current instruction. Examples – staa 1,-SP – staa 1,SP- – ldx 2,+SP – ldx 2,SP+

Accumulator Offset Indexed Addressing The effective address of the operand is the sum of the accumulator and the base index register. – The base register can be X, Y, SP, or PC. – The accumulator can be the 8-bit A or B or the 16-bit accumulator D. – Example ldaa B,X stab B,Y

The value in D is added to the value in the base index register to form the address of the memory location that contains the address to the memory location affected by the instruction. The square brackets distinguish this addressing mode from accumulator D offset indexing. Example jmp[D,PC] go1dc.wtarget1 go2dc.wtarget2 go3dc.wtarget3 … target1…. target2…. target3… Accumulator D Indirect Indexed Addressing

HCS12 Instruction Examples The LOAD and STORE instructions – The LOAD instruction copies the contents of a memory location or places an immediate value into an accumulator or a CPU register. – STORE instructions save the contents of a CPU register into a memory location. – N and Z flags of the CCR register are automatically updated and the V flag is cleared. All except for the relative mode can be used to select the memory location or value to be loaded into an accumulator or CPU register. All except for the relative and immediate modes can be used to select memory location to store contents of the CPU register. For example, – ldaa 0,X – staa $20 – stx $8000 – ldd #100

Transfer and Exchange Instructions (1 of 2) Transfer instructions copy the contents of a CPU register or accumulator into another CPU register or accumulator. TFR is the universal transfer instruction, but other mnemonics are accepted for compatibility with the 68HC11. The TAB and TBA instructions affect the N, Z, and V condition code bits. The TFR instruction does not affect any condition code bits. For example, – TFR D,X; [D]  X – TFR A,B; [A]  B – TFR A,X; 0:[A]  X ; upper 8-bit of X is cleared to 0 – TFR X,A; X[7:0]  A; lower 8 bits copied to A

The EXG instruction exchanges the contents of a pair of registers or accumulators. For example, exg A, B exg D,X exgA,X; A  X[7:0], X  $00:[A] exgX,B; X  $00:[B], B  X[7:0] The SEX instruction sign-extend an 8-bit two’s complement number into a 16-bit number so that it can be used in 16-bit signed operations. For example, SEXA,X Transfer and Exchange Instructions (2 of 2)

Move Instructions These instructions move data bytes or words from a source to a destination in memory. Six combinations of immediate, extended, and index addressing modes are allowed to specify the source and destination addresses: – IMM  EXT, IMM  IDX, EXT  EXT, EXT  IDX, IDX  EXT,IDX  IDX – For example, movb$100,$800 movw0,X, 0,Y

Add and Subtract Instructions These instructions perform fundamental arithmetic operations. The destinations of these instructions are always a CPU register or accumulator. There are two-operand and three-operand versions of these instructions. Three-operand ADD or SUB instructions always include the C flag as one of the operand. Three-operand ADD or SUB instructions are used to perform multi-precision addition or subtraction. Example adda $1000; A  [A] + [$1000] adca $1000; A  [A] + [$1000] + C suba $1002; A  [A] + [$1002] sbca $1000; A  [A] - [$1000] - C

Instruction Execution Cycle – One or more read cycles to fetch instruction opcode bytes and addressing information – One or more read cycles to fetch the memory operand (s) (optional) – Perform the operation specified by the opcode – One or more write cycles to write back the result to either a register or a memory location (optional) Instruction Queue – The HCS12 executes one instruction at a time and many instructions take several clock cycles to complete. – When the CPU is performing the operation, it does not need to access memory. The HCS12 prefetches instructions when the CPU is not accessing memory to speedup the instruction execution process. There are two 16-bit queue stages and one 16-bit buffer. Unless buffering is required, program information is first queued in stage 1, and then advanced to stage 2 for execution.

Embedded System Any product that uses a microprocessor or microcontroller as its controller. Functionality is the focus not the processor itself. Weather Station

Other Examples of Embedded System Cell phone: making the phone call, accepting incoming call, accessing Internet, displaying Web page: handling input/output, keeping track of time, taking picture, and playing game Home security system: sensing external temperature, smoke, humidity, and intruders; taking appropriate actions according to the detected events Automobile: monitoring speed, gas level, temperature, distance, direction, and so on; controlling display, full injection, air bag deployment, cruising, and so on; giving warnings Network router: responsible for message routing, congestion and traffic control, and so on