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

Similar documents
Mark II Aiken Relay Calculator

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

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

CS/ECE 5780/6780: Embedded System Design

538 Lecture Notes Week 5

538 Lecture Notes Week 5

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

Programming the Motorola MC68HC11 Microcontroller

Ryerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 2003

1. Memory Mapped Systems 2. Adding Unsigned Numbers

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

Cross Assembly and Program Development

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

ECE 367 -Experiment #1 Fall 2012

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

Microcontrollers. Microcontroller

68HC12 Training Lab Student Exercise Book

8.7. Finite state machines with statically-allocated linked structures Stepper motor controller L 293

EE 3170 Microcontroller Applications

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

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

Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3. You will be able to use all of the Motorola data manuals on the exam.

Chapter. Computer Architecture

Introduction to the 9S12 Microcontroller

MC9S12 Address Space

C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions

AN Kbyte Addressing with the M68HC11. Overview

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)

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

ME 6405 Introduction to Mechatronics

Comparison of C and Assembly How to compile a C program using CodeWarrior

Wed. Aug 23 Announcements

Go Gators! Relax! May the Schwartz be with you!

m 1 se 7 m 23 Introduction to Embedded Microcomputer Systems Lecture 16.1 Recap Finite State Machines Pointer implementation

538 Lecture Notes Week 2

Input and Output Ports. How do you get data into a computer from the outside?

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

ECE3120: Computer Systems Hardware & Software Development Tools

EE4390 Microprocessors

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

What is an Addressing Mode?

Programming Book for 6809 Microprocessor Kit

Lecture 7 Assembly Programming: Shift & Logical

Comparison of C and Assembly How to compile a C program using CodeWarrior

Exam 1 Feb. 23, 25, 27?

ME 4447 / ME 6405: Introduction to Mechatronics

Introduction to Mechatronics. Fall Instructor: Professor Charles Ume. Interrupts and Resets

ECE372 CodeWarrior Simulator Andreou/Michaelides

538 Lecture Notes Week 3

A Simple MC9S12 Program

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING. Principles of Computer Operation

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

538 Lecture Notes Week 1

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

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING

COSC345 Software Engineering. Basic Computer Architecture and The Stack

Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3

EE345L Spring 2006 May 10, 2006, 2-5pm Page 1 of 8

Coe538 Final Study Guide 2016 (Questions & Answers)

Exam I Review February 2017

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

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

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Introduction to Embedded Microcomputer Systems Lecture 6.1

2) [ 2 marks] Both of the following statements cause the value $0300 to be stored in location $1000, but at different times. Explain the difference.

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES

Chapter 2: HCS12 Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

ECE/CE 3720: Embedded System Design

ECE/CS 3720: Embedded System Design (ECE 6960/2 and CS 6968)

EE319K Laborartory Manual Univ of Texas at Austin Bard, Daniels, Welker Spring 2008

History and Basic Processor Architecture

Chapter 4: Advanced Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh

Chapter 2 HCS12 Assembly Language

Wed. Sept 6 Announcements

EE 308 Spring Lecture 28 March 30, 2012 Review for Exam 2. Introduction to the MC9S12 Expanded Mode

instruction 1 Fri Oct 13 13:05:

Addition and Subtraction of Hexadecimal Numbers Simple assembly language programming

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

ECE 3610 MICROPROCESSING SYSTEMS AN ENCRYPTED ASCII CODE DECODER

EE 3170 Microcontroller Applications

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

ECE/CE 3720: Embedded System Design

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

0b) [2] Can you name 2 people form technical support services (stockroom)?

COSC 243. Computer Architecture 1. COSC 243 (Computer Architecture) Lecture 6 - Computer Architecture 1 1

Using the stack and the stack pointer

Lecture 6 Assembly Programming: Branch & Iteration

Decimal, Hexadecimal and Binary Numbers Writing an assembly language program

It translates (converts) assembly language to machine code.

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

HC11 Instruction Set

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

Introduction to Microcontrollers

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

MC68HC12 Parallel I/O

Microcomputer Architecture and Programming

E3940 Microprocessor Systems Laboratory. Introduction to the Z80

Introduction to the MC9S12 Hardware Subsystems

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ).

The Motorola 68HC11 Instruc5on Set

Transcription:

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

Introduction (von Neumann architecture) processor Bus Memory Mapped I/O System Input Devices Input Signals RAM ROM Output Devices Output Signals 9S12C32 MC68HC812A4 I/O $0000 to $03FF I/O $0000 to $01FF Ports AD, M, S, T Ports A,B,C,D,E,F,H,J,S,T,AD 2K RAM $3800 to $3FFF 1K RAM $0800 to $0BFF 32K ROM $4000 to $7FFF 4K ROM $F000 to $FFFF $8000 to $FFFF

Harvard Architecture 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 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

Architecture terms 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 processor RAM ROM data CPU Write Cycle input devices output devices Bus input signals output signals

9S12 architecture processor registers CCR A:B X Y SP PC bus interface unit EAR control unit IR ALU control address data 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

9S12 architrecture 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 7 0 operation S X H I N Z V C CC 15 Register A 8 Register B 8 bit condition code D two 8 bit accumulators X 16 bit index register Y 16 bit index register SP 16 bit stack pointer PC 16 bit program counter 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

9S12 architecture The arithmetic logic unit (ALU) Arithmetic operations 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

Lab 1. Logic Function The specific function you will implement is T M & A This means the LED will be on if and only if the M switch is pressed and the A switch is not pressed, as shown below

Lab 1 void main(void){ ATD0DIEN = 0xFF; // make Port AD0 digital input DDRM = 0x00; // make Port M an input, PM2 is M DDRT = 0xFF; // make Port T an output, PT2 is T while(1){ PTT = (~PORTAD0)&PTM; // LED on iff PAD2=0 and PM2=1 } } The first C program to illustrate Lab 1. ;****************** Lab1.RTF *************** ; Program written by: Your Name ; Date Created: 8/19/2007 6:34:15 PM ; Last Modified: 8/19/2007 6:34:19 PM ; Section 1-2pm TA: Robin Tsang ; Lab number: 1 ; Brief description of the program ; The overall objective of this system is a digital lock ; Hardware connections ; PM2 is switch input M ; PAD2 is switch input A ; PT2 is LED output T (on means unlocked) ; The specific operation of this system ; unlock if A is not pressed and M is pressed ;I/O port definitions ATDDIEN equ $008D ; ATD Input Enable Mask Register PTM equ $0250 ; Port M I/O Register PTAD equ $0270 ; Port AD I/O Register on the 9S12C32 PORTAD0 equ $008F ; Port AD I/O Register on the 9S12DP512 PTT equ $0240 ; Port T I/O Register DDRM equ $0252 ; Port M Data Direction Register DDRAD equ $0272 ; Port AD Data Direction Register (skip this on the 9S12DP512) DDRT equ $0242 ; Port T Data Direction Register org $3800 ; RAM ($0800 if 9S12DP512) ; Global variables (none required for this lab) org $4000 ; flash EEPROM main ldaa #$04 staa DDRT ; PT2 is output to LED T staa ATDDIEN ; PAD2 is input from switch A ldaa #$00 staa DDRM ; PM2 is input from switch M staa DDRAD ; skip this on DP512 loop ldaa PTAD eora #$04 ; bit 2 is ~A anda PTM ; bit 2 is (~A)&M staa PTT ; output bit 2 to PT2 bra loop org $FFFE fdb main ;Starting address

TExaS Editor Source code PORTA equ $0000 DDRA equ $0002 org $0800 cnt rmb 2 org $F000 main lds #$0C00 movb #$80,DDRA off bclr PORTA,#$80 look ldd #4444 std cnt loop ldaa PORTA anda #$7F cmpa key bne off ldx cnt dex stx cnt bne loop bset PORTA,#$80 bra look key fcb %00100011 org $FFFE fdb main Assembler TExaS Object code $F000 CF0C00 $F003 180B800002 $F008 4D0080 $F00B CC115C $F00E 7C0800 $F011 9600 $F013 847F $F015 B1F028 $F018 26EE $F01A FE0800 $F01D 09 $F01E 7E0800 $F021 26EE $F023 4C0080 $F026 20E3 $F028 23 $FFFE F000 Loader Simulated Microcomputer processor RAM ROM I/O Simulated External circuits and devices

TExaS A1.5. Tutorial A1. Getting started The purpose of this tutorial is to introduce the first time user to TExaS. 1) how to launch the simulator, 2) how to modify input switches, 3) how to edit, assemble, and run a 9S12 program, 4) how to modify display format in the ViewBox, 5) how to move and resize windows, 6) how to get on-line help. visualize four places information can be stored on a computer. 1) external switches are input devices that hold information, 2) registers are high-speed temporary storage inside the processor, 3) global variables can hold information that is easy to access, 4) external LEDs are output devices that hold information.