Mark II Aiken Relay Calculator

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

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

CS/ECE 5780/6780: Embedded System Design

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

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

Exam I Review February 2017

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

EE319 K Lecture 7. Address mode review Assembler, Debugging Psuedo ops 16 bit timer finite state machines. University of Texas ECE

Cross Assembly and Program Development

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

Microcontrollers. Microcontroller

538 Lecture Notes Week 5

N bit is set if result of operation in negative (MSB = 1) Z bit is set if result of operation is zero (All bits = 0)

538 Lecture Notes Week 5

MC9S12 Address Space

EE 3170 Microcontroller Applications

What is an Addressing Mode?

Chapter. Computer Architecture

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

Chapter 7 Central Processor Unit (S08CPUV2)

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

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

Programming the Motorola MC68HC11 Microcontroller

EE319K Final Fall 2005 Solution C. (3) Question 1. (3) Question 2. short function(const short in){ return in+5; } const

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

E3940 Microprocessor Systems Laboratory. Introduction to the Z80

1. Memory Mapped Systems 2. Adding Unsigned Numbers

A Simple MC9S12 Program

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Introduction to Computers - Chapter 4

Wed. Aug 23 Announcements

538 Lecture Notes Week 1

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

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

8051 Overview and Instruction Set

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

Harry H. Porter, 2006

1. Introduction to Assembly Language

17. Instruction Sets: Characteristics and Functions

Wednesday, February 4, Chapter 4

8051 Microcontrollers

Introduction to the 9S12 Microcontroller


Computers and Microprocessors

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

CHAPTER 8. Solutions for Exercises

MOS 6502 Architecture

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

Lecture #2 January 30, 2004 The 6502 Architecture

EXPERIMENT NO. 1 THE MKT 8085 MICROPROCESSOR TRAINER

LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz

Introduction to CPU architecture using the M6800 microprocessor

Most of the HC12 s instructions access data in memory There are several ways for the HC12 to determine which address to access

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

Lecture #3 Microcontroller Instruction Set Embedded System Engineering Philip Koopman Wednesday, 20-Jan-2015

Microcomputer Architecture and Programming

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

Lecture1: introduction. Outline: History overview Central processing unite Register set Special purpose address registers Datapath Control unit

When an instruction is initially read from memory it goes to the Instruction register.

Introduction to Microcontrollers

Chapter 1. Solutions Solution 1.1. Most RAMs are volatile, meaning the information is lost if power is removed then restored.

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

COSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture)

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

EE 3170 Microcontroller Applications

CPU: SOFTWARE ARCHITECTURE INSTRUCTION SET (PART

UNIVERSITY OF MANITOBA DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING. Term Test #2 Solution ECE 3610 MICROPROCESSING SYSTEMS

Wednesday, September 13, Chapter 4

CC411: Introduction To Microprocessors

Computer Organization and Programming

538 Lecture Notes Week 3

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

Introduction to Programming

Wed. Sept 6 Announcements

Chapter 3. Z80 Instructions & Assembly Language. Von Neumann Architecture. Memory. instructions. program. data

Computer Architecture 2/26/01 Lecture #

Module Contents of the Module Hours COs

HC11 Instruction Set

The Microcontroller. Lecture Set 3. Major Microcontroller Families. Example Microcontroller Families Cont. Example Microcontroller Families

ECE 4510/5530 Microcontroller Applications Chapter 1

Lecture 5 Assembly Programming: Arithmetic

THE MICROPROCESSOR Von Neumann s Architecture Model

EE 3170 Microcontroller Applications

ELEG3924 Microprocessor

Instruction Sets: Characteristics and Functions

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

COSC345 Software Engineering. Basic Computer Architecture and The Stack

Macro Assembler. Defini3on from h6p://

ECE 367 -Experiment #1 Fall 2012

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

QUESTION BANK. EE 6502 / Microprocessor and Microcontroller. Unit I Processor. PART-A (2-Marks)

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

COS 140: Foundations of Computer Science

ECE 3120 Lab 1 Code Entry, Assembly, and Execution

CS 261 Fall Binary Information (convert to hex) Mike Lam, Professor

538 Lecture Notes Week 2

Computer Organization MIPS ISA

Transcription:

Introduction to Embedded Microcomputer Systems Lecture 6.1 Mark II Aiken Relay Calculator 2.12. Tutorial 2. Arithmetic and logical operations format descriptions examples h 8-bit unsigned hexadecimal $00 $12 $FF d 8-bit unsigned decimal 0 18 255 b 8-bit unsigned binary %00000000 %00010010 H 16-bit unsigned hexadecimal $0000 $1234 $FFFF D 16-bit unsigned decimal 0 4660 65535 B 16-bit unsigned binary %0001001000110100 -h or +h 8-bit signed hexadecimal -$80 +$12 +$7F -d or +d 8-bit signed decimal -128 +18 +127 -b or +b 8-bit signed binary -%10000000 +%00010010

Introduction to Embedded Microcomputer Systems Lecture 6.2 -H or +H 16-bit signed hexadecimal -$8000 +$1234 +$7FFF -D or +D 16-bit signed decimal -32768 +4660 +32767 -B or +B 16-bit signed binary -+%0001001000110100 b3 3-bit binary (lsb) %000 %111 b4 4-bit binary (lsb) %0000 %1111 cc 8-bit binary CCR sxhinzvc c or C ASCII character 'A' 'x' '0' s or S ASCII string "Hello World" v address itself, unsigned dec 2048 V address itself, unsigned hex $0800 +v or v address itself, signed dec -32768 +0 +32767 +V or V address itself, signed hex -$8000 +0 +$7FFF Table 2.23. Available formats for displaying ViewBox. Chapter 3 objectives are to: Present basic microcomputer architecture, List available 6812 microcomputers and their memory configurations, Define some of machine level instructions available on the 6812, Explain how the computer uses addressing modes to access memory, Introduce I/O ports 3.1. Introduction processor Bus Memory Mapped I/O System Input Devices Input Signals RAM ROM Output Devices Output Signals Figure 3.1. A memory-mapped computer system. The memory maps 9S12C32 MC68HC812A4

Introduction to Embedded Microcomputer Systems Lecture 6.3 I/O $0000 to $03FF $0000 to $01FF Ports AD, M, S, T A,B,C,D,E,F,H,J,S,T,AD RAM $3800 to $3FFF $0800 to $0BFF 2K 1K ROM $4000 to $7FFF $F000 to $FFFF $8000 to $FFFF 32K 4K ******************* JWVLab4_2.RTF *************** * The overall purpose EE319K Lab 4.2 Fall 2004 * and your TA * Robin Tsang or Nachiket Kharalkar * Creation date: 8/4/2004 11:29:47 AM * Last modification date: 8/24/2004 8:57:55 PM * External hardware: * PT3 output connected to LED, P * PT1 input connected to a switch, M * PT0 input connected to a switch, N * Detailed description * Two input switches N,M * One output LED P * Function P = N M * Define Input/Output ports PTT equ $0240 DDRT equ $0242 * Global variables org $3800 globals go in RAM M rmb 1 boolean, true if pressed org $4000 object code goes in ROM main lds #$4000 initialize stack * stuff executed once, at start up loop * stuff executed over and over forever bra loop repeat * reset vector org $FFFE fdb main starting address after a RESET

Introduction to Embedded Microcomputer Systems Lecture 6.4 Intel x86 processor Memory Control Isolated I/O System I/O Control IOR, IOW Input Devices Input Signals RAM MEMR, MEMW ROM Output Devices Address, Data Output Signals Figure 3.2. An isolated-i/o computer system. Memory mapped ldaa 0 staa M staa 1 I/O Mapped in al,0 mov M,al out 1,al input port save in memory output port bus address where or which module data what control when and direction processor RAM data ROM CPU Read Cycle input devices output devices Bus input signals output signals

Introduction to Embedded Microcomputer Systems Lecture 6.5 Figure 3.3. A read cycle copies data from RAM, ROM or input device into the processor. processor RAM ROM data CPU Write Cycle input devices output devices input signals output signals Bus Figure 3.4. A write cycle copies data from the processor into RAM, or output device. Checkpoint 3.2: The 6812 has a 16-bit address bus and a 16-bit data bus, but can still only address 65536 bytes of memory. Why? processor registers CCR A:B X Y SP PC bus interface unit EAR control unit IR ALU control address data Figure 3.7. The four basic components of 6812 processor. The bus interface unit (BIU) reads data from the bus during a read cycle, writes data onto the bus during a write cycle. always drives the address bus and the control signals effective address register (EAR) contains the data address The control unit (CU) orchestrates the sequence of operations issues commands to ALU, BIU instruction register (IR) contains the op code

Introduction to Embedded Microcomputer Systems Lecture 6.6 The registers high-speed storage devices located in the processor do not have addresses like regular memory specific functions explicitly defined by the instruction Accumulators contain data (A, B, D) Index registers contain addresses (X, Y) Program counter (PC) points to instruction to execute next Stack pointer (SP) points to the top element on the stack context switch when calling and returning from a function pass parameters save temporary information implement local variables Condition code register (CCR) the status of the previous operation 15 Register A 7 0 S X H I N Z V C 8 Register B CC PC 16 bit program counter Figure 3.8. The 6811 and 6812 have 6 registers. D X Y SP 8 bit condition code two 8 bit accumulators 16 bit index register 16 bit index register 16 bit stack pointer CC S X H I N Z V C Carry/borrow or unsigned overflow Signed overflow Zero Negative IRQ Interrupt Mask Half Carry from bit 3 XIRQ Interrupt Mask Stop disable Figure 3.9. The 6811/6812 condition code bits. The arithmetic logic unit (ALU) Arithmetic operations

Introduction to Embedded Microcomputer Systems Lecture 6.7 Addition Subtraction Multiplication Division Logic operations And Or Exclusive or Shift The simplified execution has five phases: Phase Function R/W Address Comment 1 Op code fetch read PC++ Put data into IR, 2 Operand fetch read PC++ Immediate or calculate EA 3 Data read read SP,EAR Data passes through ALU, 4 Free cycle read PC/SP/$FFFF ALU operations, set CCR 5 Data store write SP,EAR Results stored in memory 9S12C32

Introduction to Embedded Microcomputer Systems Lecture 6.8 In the single chip operating mode, the 9S12C32 is a single chip complete microcomputer (microcontroller), where all its I/O ports are available. 3.2.2. Terminology w signed 8-bit or unsigned 8-bit n is a signed 8-bit -128 to +127 u is a unsigned 8-bit 0 to 255 W is a signed 16-bit or unsigned 16-bit N is a signed 16-bit -32787 to +32767 U is a unsigned 16-bit 0 to 65535 =[addr] an 8-bit read from addr

Introduction to Embedded Microcomputer Systems Lecture 6.9 ={addr} a 16-bit read from addr using "big endian" [addr]= an 8-bit write to addr {addr}= a 16-bit write to addr using "big endian" The label field optional starts in the first column used to identify the position in memory must choose a unique name for each label The opcode field specifies the microcomputer command to execute. could be pseudo op, which are instructions to the assembler The operand field specifies where to find the data to execute the instruction 0, 1, 2, or 3 operands The comment field optional ignored by the computer makes it easier to understand explain how it works why design choices were made how to test it how to change it label opcode operand comment here ldaa 100 RegA=[$0064]

Introduction to Embedded Microcomputer Systems Lecture 6.10 Object code instruction comment $96 $64 ldaa 100 RegA=[$0064] 3.2.3. Addressing modes Where to find the data? inherent no operand or implied operand immediate in the instruction itself direct or extended absolute address of the data relative where to go for branch instructions object op code operand comment $87 clra A = 0 (inherent) $86 24 ldaa #36 A = $24 (immediate)

Introduction to Embedded Microcomputer Systems Lecture 6.11 $96 24 ldaa 36 A = [$0024] (direct) $B6 08 01 ldaa $0801 A = [$0801] (extended) $20 FE bra $F000 relative addressing Table 3.2. Simple addressing modes. 1. Inherent addressing mode has no operand field sometimes there is no data stop sometimes the data for the instruction is implied. clra sometimes the data must be fetched, but the address is implied pula 2. Immediate addressing mode uses a fixed data constant.

Introduction to Embedded Microcomputer Systems Lecture 6.12 A $24 EEPROM $F800 $F801 $86 $F802 $24 $F803 }ldaa #36 Figure 3.10. Example of the immediate addressing mode. The TExaS simulation of this instruction shows the following two cycles. Opcode fetch R 0xF801 0x86 from EEPROM Operand fetch R 0xF802 0x24 from EEPROM 3. Direct Page addressing mode uses an 8-bit address access from addresses 0 to $00FF called zero-page. on the 6812 they reference the I/O ports the < operator forces direct addressing A $57 $0035 $0036 $57 $0037 EEPROM $F800 $F801 $96 $F802 $24 $F803 Figure 3.11. Example of the direct-page addressing mode. I/O }ldaa 36 The TExaS 6812 simulation this instruction shows the following three cycles. Opcode fetch R 0xF801 0x96 from EEPROM Operand fetch R 0xF802 0x24 from EEPROM Fetch using EARR 0x0024 0x57 from I/O 4. Extended addressing mode uses a 16-bit address access all memory and I/O devices outside Motorola family this addressing mode is called direct the > operator forces extended addressing A $62 RAM $0800 $0801 $62 $0802 EEPROM $F800 $F801 $B6 $F802 $08 $F803 $01 }ldaa $0801

Introduction to Embedded Microcomputer Systems Lecture 6.13 Figure 3.12. Example of the extended addressing mode. The TExaS 6812 simulation of this instruction shows the following four cycles. Opcode fetch R 0xF801 0xB6 from EEPROM Operand fetch R 0xF802 0x08 from EEPROM Operand fetch R 0xF803 0x01 from EEPROM Fetch using EARR 0x0801 0x62 from RAM Common Error: It is wrong to assume the < and > operators affect the amount of data that is transferred. The < and > operators will affect the addressing mode, that is how the address is represented. Observation: Accesses to Registers A, B and CC transfer 8 bits, while accesses to Registers D, X, Y, SP, and PC transfer 16 bits regardless of the addressing mode. 5. PC Relative addressing mode is used for the branch instructions stored in the machine code is not the absolute address but the 8-bit signed offset relative distance from the current PC value the PC already points to the next instruction the assembler calculates it for us

Introduction to Embedded Microcomputer Systems Lecture 6.14 1) address of current instruction $F880 bra $F840 2) op code of branch instruction, and size of instruction $F880 $20rr bra $F840 3) address of next instruction $F880 $20rr bra $F840 $F882 4) calculate PC relative addressing rr = destination address of next instruction = $F840 - $F882 = -$42 = $BE The object code for this instruction will be $20BE. 1) address of current instruction $F000 bra $F044 2) op code of branch instruction, and size of instruction $F000 $20rr bra $F044 3) address of next instruction $F000 $20rr bra $F044 $F002 4) calculate PC relative addressing

Introduction to Embedded Microcomputer Systems Lecture 6.15 rr = destination address of next instruction = $F044 - $F002 = $42 The object code for this instruction will be $2042. 1) address of current instruction $F000 bra $F144 2) op code of branch instruction, and size of instruction $F000 $20rr bra $F144 3) address of next instruction $F000 $20rr bra $F144 $F002 4) calculate PC relative addressing rr = destination address of next instruction = $F144 - $F002 = $142 Branch out of range assembly error.