1 / 8

ECE 3430 – Introduction to Microcomputer Systems University of Colorado at Colorado Springs

This lecture covers the HC11 microcontroller's programming model, including accumulators, registers, CPU instructions, and addressing. It also explains memory addressing and the memory map of the HC11.

kristam
Download Presentation

ECE 3430 – Introduction to Microcomputer Systems University of Colorado at Colorado Springs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 3430 – Introduction to Microcomputer SystemsUniversity of Colorado at Colorado Springs Lecture #3 Agenda Today • HC11 Programming Model • Accumulators and Registers • CPU Instructions and Addressing ECE 3430 – Intro to Microcomputer Systems Fall 2009

  2. 68HC11 Microcontroller HC11 - The 8-bit microcontroller that we will be using in the lab. Registers - I/O Registers are mapped into memory space and treated as a normal memory address by the programmer. CPU registers are used to perform general purpose operations (arithmetic, logic) They do not occupy memory space but are accessible by the programmer. Accumulators - Special type of register which contains an operand to be used in some arithmetic operation. The HC11 has two 8-bit accumulators called A and B. The A and B accumulators can be used together to form a virtual 16-bit accumulator called D. ACCD[15:0] = {ACCA[7:0], ACCB[7:0]} Index Registers - 16-bit registers used mainly for addressing operations. The HC11 has two 16-bit index registers called X and Y. Stack Pointer - 16-bit register that points to the STACK. The STACK is a 1st in, last out structure. The Stack Pointer (SP) points to the address above the TOP element in the Stack. Program Counter - 16-bit register that holds the location of the next instruction to be executed (PC). ECE 3430 – Intro to Microcomputer Systems Fall 2009

  3. 68HC11 Programming Model ECE 3430 – Intro to Microcomputer Systems Fall 2009

  4. 68HC11 Microcontroller Condition Code Register - 8-bit register that tracks the status of operations, branches, and interrupts. With the exception of S, X, and I, the other flags are updated by the ALU to reflect the current status following the last arithmetic or logical operation. CCR[7:0] = {S,X,H,I,N,Z,V,C} S = Stop Disable X = X interrupt mask H = Half Carry I = ‘I’ interrupt mask N = Negative Result Z = Zero Result V = Overflow C = Carry Memory Addressing – The HC11 is a byte-addressable architecture. This means that each address addresses an 8-bit value stored in memory. The HC11 uses 16-bits for addressing. The HC11 has 16 address lines = 216 = 65,536 locations The CPU reads/writes to memory by: 1) Providing a 16-bit address to the memory via the address bus. 2) Accepting an 8-bit data value from memory across the data bus. The data is multiplexed onto the address bus using the least significant 8 bits (see block diagram). Address Data CPU Memory ECE 3430 – Intro to Microcomputer Systems Fall 2009

  5. 68HC11 Microcontroller Memory Map – A graphical way to illustrate memory. We will use this continually throughout the semester. The HC11 has an address range from $0000 to $FFFF Kilobyte - K = 210 = 1024, so we say we have a 64k byte memory Megabyte - M = K2 = 1,048,576 ex) when we say “64k” byte memory, that is actually (64)(210) = 65,536 bytes # of Address Lines - 2(# of address lines) = the number of locations we can access with that many lines. $0000 $0001 : $FFFE $FFFF 8-bits ECE 3430 – Intro to Microcomputer Systems Fall 2009

  6. Instructions and Addressing Instruction - An HC11 instruction consists of one or more opcodes. Zero or more operands follow an opcode in memory to provide information used by the instruction. Opcode - Machine code for a specific instruction in the HC11 instruction set. Operand - The data or address information used by the instruction. Memory Notation - “M” = contents of memory () = address Ex) M($0000) = $ff M($0002) = $55 Memory Program Counter $0000 $ff $0001 $12 $0002 $55 ECE 3430 – Intro to Microcomputer Systems Fall 2009

  7. 68HC11 Instructions (Sampler) The HC11 is a load/store architecture. In this architecture, all opcodes and operands must be loaded into the CPU registers for processing. When a calculation is done, the results must be stored back out to memory. Operands cannot be directly addressed in memory without loading them into the CPU registers first. Example load instruction: LDAA = load a value into accumulator A. Example store instruction: STAA = store value in accumulator A to memory ECE 3430 – Intro to Microcomputer Systems Fall 2009

  8. 68HC11 Instructions More load instructions: • LDAA = loads accumulator A with 8-bit value • LDAB = loads accumulator B with 8-bit value • LDD = loads “virtual” accumulator D with 16-bit value (blows away what was stored in A and B) • LDX = loads index register X with 16-bit value • LDY = loads index register Y with 16-bit value • LDS = loads the stack pointer register with 16-bit value More store instructions: • STAA = stores accumulator A contents to memory • STAB = stores accumulator B contents to memory • STD = stores accumulator D contents to memory • STX = stores index register X contents to memory • STY = stores index register Y contents to memory • STS = stores stack pointer register contents to memory ECE 3430 – Intro to Microcomputer Systems Fall 2009

More Related