ECE/CE 3720: Embedded System Design

Size: px
Start display at page:

Download "ECE/CE 3720: Embedded System Design"

Transcription

1 Produce-Consumer Examples Slide 1 ECE/CE 3720: Embedded System Design Chris J. Myers Slide 3 Source/producer Keyboard input Program with data Sink/consumer Program that interprets Printer output Lecture 7: FIFOs Program sends message Program receives message Microphone and ADC Program that saves sound data Program that has sound data DAC and speaker Introduction to FIFOs Two-Pointer FIFO FIFO circular queue is useful for a buffered I/O interface. This order-preserving data structure temporarily saves data created by producer before processed by consumer. Slide 2 Decouples the producer from the consumer. Use statically allocated global memory, so they can be shared by threads, but must be accessed carefully. Slide 4 (See Figures 4.15 and 4.16) (See Figure 4.13) 1 2

2 Slide 5 Basic Idea of FIFO GetPt rmb 2 Ptr to oldest data, next to be removed PutPt rmb 2 Ptr to free memory, place to put next * Reg A contains byte to store into the FIFO PutFifo ldx PutPt Reg X points to free place staa,x Store data into FIFO inx Update pointer * Reg A returned with byte from FIFO GetFifo ldx GetPt Reg X points to oldest data ldaa,x Read data from FIFO inx Update pointer stx GetPt Slide 7 Initialization of a Two-Pointer FIFO in Assembly FifoSize equ 10 Size of Fifo PutPt rmb 2 Pointer where to put next */ GetPt rmb 2 Pointer where to get next * FIFO is empty if PutPt=GetPt * FIFO is full if PutPt+1=GetPt (with wrap) Fifo rmb FifoSize The fifo data InitFifo ldx #Fifo tpa sei entering critical section stx GetPt Empty when PutPt=GetPt tap end critical section Initialization of a Two-Pointer FIFO in C PutFifo for a Two-Pointer FIFO in C Slide 6 #define FifoSize 10 /* Size of Fifo */ char *PutPt; /* Ptr of where to put next */ char *GetPt; /* Ptr of where to get next /* FIFO is empty if PutPt=GetPt */ /* FIFO is full if PutPt+1=GetPt (with wrap) */ char Fifo[FifoSize]; /* The fifo data */ void InitFifo(void) { char SaveSP; asm(" tpa\n staa %SaveSP\n sei"); /* critical */ PutPt=GetPt=&Fifo[0]; /* Empty when PutPt=GetPt */ Slide 8 int PutFifo (char data) { char *Ppt; char SaveSP; asm(" tpa\n staa %SaveSP\n sei"); /* critical */ Ppt=PutPt; /* Copy of put pointer */ *(Ppt++)=data; /* Put data into fifo */ if (Ppt == &Fifo[FifoSize]) Ppt = &Fifo[0]; if (Ppt == GetPt ) { return(0); /* Failed, fifo was full */ PutPt=Ppt; return(-1); /* Successful */ 3 4

3 Slide 9 PutFifo for a Two-Pointer FIFO in Assembly * Input RegA contains 8 bit data to put * Output RegA is -1 if successful, 0 otherwise PutFifo psha tpa tab pshb save old CCR sei critical section ldx PutPt Temporary put pointer staa 0,x Try to put data into fifo inx cpx #Fifo+FifoSize Slide 11 GetFifo for a Two-Pointer FIFO in C int GetFifo (char *datapt) { char SaveSP; if (PutPt == GetPt ) { return(0); /* Empty if PutPt=GetPt */ *datapt=*(getpt++); if (GetPt == &Fifo[FifoSize]) GetPt = &Fifo[0]; return(-1); PutFifo for a Two-Pointer FIFO in Assembly GetFifo for a Two-Pointer FIFO in Assembly Slide 10 bne PutNoWrap skip if no wrap needed ldx #Fifo Wrap PutNoWrap clra assume it will fail cpx GetPt Full if now the same beq PutDone coma RegA=-1 means OK PutDone tab end critical section Slide 12 * Input RegX points to place for 8 bit data * Output RegA is -1 if successful, 0 if Fifo empty GetFifo tpa psha save old CCR sei critical section clra assume it will fail ldy GetPt cpx PutPt Empty if initially same beq GetDone coma RegA=-1 means OK ldab 0,y Data from FIFO stab 0,x Return by reference iny 5 6

4 Initialization of a Two-Ptr/Cnt FIFO in Assembly Slide 13 GetFifo for a Two-Pointer FIFO in Assembly cpy #Fifo+FifoSize bne GetNoWrap skip if no wrap needed ldy #Fifo Wrap GetNoWrap sty GetPt GetDone tab end critical section Slide 15 FifoSize equ 10 Size of Fifo PutPt rmb 2 Pointer of where to put next GetPt rmb 2 Pointer of where to get next Size rmb 1 Fifo rmb FifoSize fifo data InitFifo tpa sei critical section ldx #Fifo stx GetPt Empty when Size == 0 clr Size tap end critical section Initialization of a Two-Pointer/Counter FIFO in C PutFifo for a Two-Pointer/Counter FIFO in C Slide 14 #define FifoSize 10 /* Size of Fifo */ char *PutPt; /* Ptr of where to put next */ char *GetPt; /* Ptr of where to get next */ unsigned char Size; /* # of elements in FIFO */ /* FIFO is empty if Size=0 */ /* FIFO is full if Size=FifoSize */ char Fifo[FifoSize]; /* fifo data */ void InitFifo(void) { char SaveSP; PutPt=GetPt=&Fifo[0]; /* Empty when Size==0 */ Size=0; Slide 16 int PutFifo (char data) { char SaveSP; if (Size == FifoSize ) { return(0); /* Failed, fifo was full */ Size++; *(PutPt++)=data; /* put data into fifo */ if (PutPt == &Fifo[FifoSize]) PutPt = &Fifo[0]; return(-1); /* Successful */ 7 8

5 PutFifo for a Two-Ptr/Cnt FIFO in Assembly GetFifo for a Two-Pointer/Counter FIFO in C Slide 17 * Input RegA contains 8 bit data to put * Output RegA is -1 if successful, 0 otherwise PutFifo psha tpa tab pshb save old CCR sei critical section ldab Size cmpb #FifoSize Full if Size==FifoSize bne PutNotFull clra bra PutDone Slide 19 int GetFifo (char *datapt) { char SaveSP; if (Size == 0 ){ return(0); /* Empty if Size=0 */ *datapt=*(getpt++); Size--; if (GetPt == &Fifo[FifoSize]) GetPt = &Fifo[0]; return(-1); Slide 18 PutFifo for a Two-Ptr/Cnt FIFO in Assembly PutNotFull incb stab Size Size++ ldx PutPt staa 0,x Put data into fifo inx cpx #Fifo+FifoSize bne PutNoWrap skip if no wrap needed ldx #Fifo Wrap PutNoWrap ldaa #-1 success means OK PutDone tab end critical section Slide 20 GetFifo for a Two-Ptr/Cnt FIFO in Assembly * Input RegX points to place for 8 bit data * Output RegA is -1 if successful, 0 if Fifo empty GetFifo tpa psha save old CCR sei critical section clra assume it will fail tst Size beq GetDone dec Size ldy GetPt coma RegA=-1 means OK ldab 0,y Data from FIFO stab 0,x Return by reference 9 10

6 Initialization of a Index FIFO in Assembly Slide 21 GetFifo for a Two-Ptr/Cnt FIFO in Assembly iny cpy #Fifo+FifoSize bne GetNoWrap skip if no wrapping needed ldy #Fifo Wrap GetNoWrap sty GetPt GetDone tab end critical section Slide 23 FifoSize equ 10 Number of 8 bit data in Fifo PutI rmb 1 Index of where to put next GetI rmb 1 Index of where to get next Size rmb 1 * FIFO is empty if Size=0 * FIFO is full if Size=FifoSize Fifo rmb FifoSize fifo data InitFifo tpa sei entering critical section clr PutI clr GetI clr Size Empty when Size == 0 tap end critical section Initialization of a Index FIFO in C PutFifo for a Index FIFO in C Slide 22 #define FifoSize 10 /* Size of Fifo */ unsigned char PutI; /* Index where to put next */ unsigned char GetI; /* Index where to get next */ unsigned char Size; /* # of elements in FIFO */ /* FIFO is empty if Size=0 */ /* FIFO is full if Size=FifoSize */ char Fifo[FifoSize]; /* fifo data */ void InitFifo(void) {char SaveSP; PutI=GetI=Size=0; /* Empty when Size==0 */ Slide 24 int PutFifo (char data) { char SaveSP; if (Size == FifoSize ) return(0); /* Failed, fifo was full */ Size++; Fifo[PutI++]=data; /* put data into fifo */ if (PutI == FifoSize) PutI = 0; /* Wrap */ return(-1); /* Successful */ 11 12

7 Slide 25 PutFifo for a Index FIFO in Assembly * Input RegA contains 8 bit data to put * Output RegA is -1 if successful, 0 otherwise PutFifo psha tpa tab pshb save old CCR sei entering critical section ldab Size cmpb #FifoSize Full if Size==FifoSize beq PutNotFull clra bra PutDone PutNotFull incb stab Size Size++ ldx #Fifo Slide 27 GetFifo for a Index FIFO in C int GetFifo (char *datapt) { char SaveSP; if (Size == 0 ) return(0); /* Empty if Size=0 */ *datapt=fifo[geti++]; Size--; if (GetI == FifoSize) GetI = 0; return(-1); Slide 26 PutFifo for a Index FIFO in Assembly ldab PutI abx staa 0,x Put data into fifo incb cmpb #FifoSize bne PutNoWrap skip if no wrap needed clrb Wrap PutNoWrap clra sucess coma RegA=-1 means OK stab PutI PutDone tab end critical section Slide 28 GetFifo for a Index FIFO in Assembly * Input RegX points to place for 8 bit data * Output RegA is -1 if successful, 0 if Fifo empty GetFifo tpa psha save old CCR sei entering critical section clra assume it will fail tst Size beq GetDone ldy #Fifo ldab GetI aby coma RegA=-1 means OK ldab 0,y Data from FIFO 13 14

8 GetFifo for a Index FIFO in Assembly Slide 29 stab 0,x Return by reference ldab GetI incb cmpb #FifoSize bne GetNoWrap skip if no wrap needed clrb Wrap GetNoWrap stab GetI GetDone tab end critical section FIFO Dynamics Rates of production/consumption vary dynamically. t p is time b/w PutFifo calls, r p is arrival rate (r p = 1 t p ). t g is time b/w GetFifo calls, r g is service rate (r g = 1 t g ). Slide 30 If min t p max t g, FIFO is not necessary. If arrival rate can temporarily increase or service rate temporarily descrease, then a FIFO is necessary. If average production rate exceeds average consumption rate (i.e., r p > r g ), then FIFO will overflow. A full error is serious because if ignored data is lost. An empty error is usually not serious. 15

Administrivia. ECE/CS 5780/6780: Embedded System Design. FIFO with Infinite Memory. Introduction to FIFOs

Administrivia. ECE/CS 5780/6780: Embedded System Design. FIFO with Infinite Memory. Introduction to FIFOs Administrivia ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 9: FIFOs CodeWarrior IDE compiler optimization configuration. No labs are scheduled next week. Please contact your TA if you

More information

Timing Generation and Measurements

Timing Generation and Measurements Timing Generation and Measurements Lab #7 Robert McManus & Junsang Cho April 2, 2004 Timing Generation and Measurements 1. Objective To gain experience using input capture to measure pulse width. To gain

More information

Programming the Motorola MC68HC11 Microcontroller

Programming the Motorola MC68HC11 Microcontroller Programming the Motorola MC68HC11 Microcontroller COMMON PROGRAM INSTRUCTIONS WITH EXAMPLES aba Add register B to register A Similar commands are abx aby aba add the value in register B to the value in

More information

Lecture 6 Assembly Programming: Branch & Iteration

Lecture 6 Assembly Programming: Branch & Iteration CPE 390: Microprocessor Systems Spring 2018 Lecture 6 Assembly Programming: Branch & Iteration Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ

More information

Pointers (2G) Young Won Lim 3/7/18

Pointers (2G) Young Won Lim 3/7/18 Pointers (2G) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Table 1: Mnemonics Operations Dictionary. Add Accumulators Add B to Y. Add with carry to B. Add Memory to B. Add 16-bit to D And B with Memory

Table 1: Mnemonics Operations Dictionary. Add Accumulators Add B to Y. Add with carry to B. Add Memory to B. Add 16-bit to D And B with Memory Table 1: Mnemonics s Dictionary ABA ABX ABY ADCA ADCB ADDA ADDB ADDD ANDA ANDB ASL ASLA ASLB ASLD ASR ASRA ASRB BCC BCLR BCS BEQ BGE BGT BHI BHS BITA BITB BLE BLO BLS BLT Add Accumulators Add B to X Add

More information

1 Execution of main program is suspended. 2 All registers are pushed onto the stack. 3 The ISR, or background thread, is executed.

1 Execution of main program is suspended. 2 All registers are pushed onto the stack. 3 The ISR, or background thread, is executed. Introduction ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 7: Interrupt Synchronization Interrupts provide guarantee on response time. Interrupts allow response to rare but important

More information

ECE/CE 3720: Embedded System Design

ECE/CE 3720: Embedded System Design Sequence of Events During Interrupt 1. Hardwere needs service (busy-to-done) transition. 2. Flag is set in one of the I/O status registers. (a) Interrupting event sets the flag (ex., STAF=1). Slide 1 ECE/CE

More information

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

ECE/CS 3720: Embedded System Design (ECE 6960/2 and CS 6968) Sequence of Events During Interrupt 1. Hardwere needs service (busy-to-done) transition. 2. Flag is set in one of the I/O status registers. (a) Interrupting event sets the flag (ex., STAF=1). Slide 1 ECE/CS

More information

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

ME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7 ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume LECTURE 7 Reading Assignments Reading assignments for this week and next

More information

Sample Problem Set #1

Sample Problem Set #1 Sample Problem Set #1 Notes: These problems are typical exam problems; most are drawn from previous homeworks and exams. This exam is open book, open notes. It may help to have a calculator. For partial

More information

ECE/CS 5780/6780: Embedded System Design

ECE/CS 5780/6780: Embedded System Design ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 8: Interrupt Synchronization Scott R. Little (Lecture 8: Interrupts) ECE/CS 5780/6780 1 / 22 Administrivia Midterm 1 will be on February

More information

The Motorola 68HC11 Instruc5on Set

The Motorola 68HC11 Instruc5on Set The Motorola 68HC11 Instruc5on Set Some Defini5ons A, B * accumulators A and B D * double accumulator (A + B) IX, IY * index registers X and Y SP * stack pointer M * some memory loca5on opr * an operand

More information

EE 3170 Microcontroller Applications

EE 3170 Microcontroller Applications Q. 3.9 of HW3 EE 37 Microcontroller Applications (a) (c) (b) (d) Midterm Review: Miller Chapter -3 -The Stuff That Might Be On the Exam D67 (e) (g) (h) CEC23 (i) (f) (j) (k) (l) (m) EE37/CC/Lecture-Review

More information

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

C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions C SC 230 Computer Architecture and Assembly Language April 2000 Exam Sample Solutions 1. (12 marks) Circle the correct answer for each of the following: The 8-bit two's complement representation of -15

More information

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

EE319K Final Fall 2005 Solution C. (3) Question 1. (3) Question 2. short function(const short in){ return in+5; } const EE319K Final Fall 2005 Solution C. Jonathan Valvano (3) Question 1. Consider a matrix with 4 rows and 6 columns, stored in column-major zero-index format. Each element is 16 bits. Which equation correctly

More information

ECE331 Handout 3- ASM Instructions, Address Modes and Directives

ECE331 Handout 3- ASM Instructions, Address Modes and Directives ECE331 Handout 3- ASM Instructions, Address Modes and Directives ASM Instructions Functional Instruction Groups Data Transfer/Manipulation Arithmetic Logic & Bit Operations Data Test Branch Function Call

More information

Lecture 9 Subroutines

Lecture 9 Subroutines CPE 390: Microprocessor Systems Spring 2018 Lecture 9 Subroutines Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 Adapted from HCS12/9S12

More information

Introduction to Semaphores. ECE/CS 5780/6780: Embedded System Design. Spin-Lock Counting Semaphore. Spin-Lock Semaphore

Introduction to Semaphores. ECE/CS 5780/6780: Embedded System Design. Spin-Lock Counting Semaphore. Spin-Lock Semaphore Introduction to Semaphores ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 11: Semaphores Semaphores used to implement synchronization, sharing, and communication between threads. A semaphore

More information

Decimal, Hexadecimal and Binary Numbers Writing an assembly language program

Decimal, Hexadecimal and Binary Numbers Writing an assembly language program Decimal, Hexadecimal and Binary Numbers Writing an assembly language program o Disassembly of MC9S12 op codes o Use flow charts to lay out structure of program o Use common flow structures if-then if-then-else

More information

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

Chapter 2: HCS12 Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh Chapter 2: HCS12 Assembly Programming EE383: Introduction to Embedded Systems University of Kentucky Samir Rawashdeh With slides based on material by H. Huang Delmar Cengage Learning 1 Three Sections of

More information

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

LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz G-CPU Important Notes (see Schwartz s lecture for a general overview) - The

More information

Module 2.F. Buffered, Interrupt-Driven Printer Design Example. Tim Rogers 2017

Module 2.F. Buffered, Interrupt-Driven Printer Design Example. Tim Rogers 2017 Module 2.F Buffered, Interrupt-Driven Printer Design Example Tim Rogers 2017 Learning Outcome #2 An ability to interface a microcontroller to various devices How? A. Bus Timing Analysis B. 9S12C Multiplexed

More information

ECET Chapter 2, Part 2 of 3

ECET Chapter 2, Part 2 of 3 ECET 310-001 Chapter 2, Part 2 of 3 W. Barnes, 9/2006, rev d. 10/07 Ref. Huang, Han-Way, The HCS12/9S12: An Introduction to Software and Hardware Interfacing, Thomson/Delmar. In This Set of Slides: 1.

More information

Introduction to Semaphores. ECE/CS 5780/6780: Embedded System Design. Spin-Lock Counting Semaphore. Spin-Lock Semaphore

Introduction to Semaphores. ECE/CS 5780/6780: Embedded System Design. Spin-Lock Counting Semaphore. Spin-Lock Semaphore Introduction to Semaphores ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 12: Semaphores Semaphores used to implement synchronization, sharing, and communication between threads. A semaphore

More information

ECE/CE 3720: Embedded System Design

ECE/CE 3720: Embedded System Design Basic Components of Input Capture Slide 1 ECE/CE 3720: Embedded System Design Chris J. Myers Lecture 12: Input Capture Slide 3 Basic Principles of Input Capture Basic Principles of Input Capture (cont)

More information

COE538 Lecture Notes Week 3 (Week of Sept 17, 2012)

COE538 Lecture Notes Week 3 (Week of Sept 17, 2012) COE538 Lecture Notes: Week 3 1 of 11 COE538 Lecture Notes Week 3 (Week of Sept 17, 2012) Announcements My lecture sections should now be on Blackboard. I've also created a discussion forum (and anonymous

More information

Using the stack and the stack pointer

Using the stack and the stack pointer Using the stack and the stack pointer o The Stack and Stack Pointer o The stack is a memory area for temporary storage o The stack pointer points to the last byte in the stack o Some instructions which

More information

1. Memory Mapped Systems 2. Adding Unsigned Numbers

1. Memory Mapped Systems 2. Adding Unsigned Numbers 1 Memory Mapped Systems 2 Adding Unsigned Numbers 1 1 Memory Mapped Systems Our system uses a memory space Address bus is 16-bit locations Data bus is 8-bit 2 Adding Unsigned Numbers 2 Our system uses

More information

Homework 12 Solutions

Homework 12 Solutions Page 1/6 1. Here is a short program that shows all addressing modes: We are given a table of student's test scores where there are three scores in a semester per student. Unfortunately, the person who

More information

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.

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. 1) [ 9 marks] Write a sequence of directives for an HCS12 assembly language program that performs all of these tasks, in this order: a) Define an array called Measurements starting from memory location

More information

EE319K Fall 2007 Quiz 1A Page 1. (5) Question 2. What will be the value of the carry (C) bit after executing the following? ldab #210 subb #60

EE319K Fall 2007 Quiz 1A Page 1. (5) Question 2. What will be the value of the carry (C) bit after executing the following? ldab #210 subb #60 EE319K Fall 2007 Quiz 1A Page 1 First: Last: This is a closed book exam. You must put your answers on this piece of paper only. You have 50 minutes, so allocate your time accordingly. Please read the entire

More information

Lab 7: Asynchronous Serial I/O

Lab 7: Asynchronous Serial I/O CpE 390 Microprocessor Systems Lab 7: Asynchronous Serial I/O 1. Introduction Serial communications is the transfer of data, one bit at a time, over a communications channel. Serial communications can

More information

SECTION 6 CENTRAL PROCESSING UNIT

SECTION 6 CENTRAL PROCESSING UNIT SECTION 6 CENTRAL PROCESSING UNIT This section discusses the M68HC11 central processing unit (CPU), which is responsible for executing all software instructions in their programmed sequence. The M68HC11

More information

538 Lecture Notes Week 3

538 Lecture Notes Week 3 538 Lecture Notes Week 3 (Sept. 16, 2013) 1/18 538 Lecture Notes Week 3 Answers to last week's questions 1 Write code so that the least significant bit of Accumulator A is cleared, the most significant

More information

Exam 2 E2-1 Fall Name: Exam 2

Exam 2 E2-1 Fall Name: Exam 2 Exam 2 E2-1 Fall 2004 1. Short Answer [20 pts] Exam 2 a. [4 points] Show the contents of registers A, B, SP, and X after the following code executes: lds #$a00 ldab #$23 A = ldaa #$87 ldx #$2543 B = pshd

More information

Serial Communication Through an Asynchronous FIFO Buffer

Serial Communication Through an Asynchronous FIFO Buffer Serial Communication Through an Asynchronous FIFO Buffer Final Project Report December 9, 2000 E155 Nick Bodnaruk and Andrew Ingram Abstract: For our clinic, we need to be able to use serial communication

More information

Assembly Language Development Process. ECE/CS 5780/6780: Embedded System Design. Assembly Language Listing. Assembly Language Syntax

Assembly Language Development Process. ECE/CS 5780/6780: Embedded System Design. Assembly Language Listing. Assembly Language Syntax Assembly Language Development Process ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 3: Assembly Language Programming Chris J. Myers (Lecture 3: Assembly Language) ECE/CS 5780/6780: Embedded

More information

ME 6405 Introduction to Mechatronics

ME 6405 Introduction to Mechatronics ME 6405 Introduction to Mechatronics Fall 2005 Instructor: Professor Charles Ume LECTURE 9 Homework 1 Solution 1. Write an assembly language program to clear the usable internal RAM in the M68HC11E9. Solution:

More information

Exam 1 Feb. 23, 25, 27?

Exam 1 Feb. 23, 25, 27? Exam 1 Feb. 23, 25, 27? You will be able to use all of the Motorola data manuals on the exam. No calculators will be allowed for the exam. Numbers Decimal to Hex (signed and unsigned) Hex to Decimal (signed

More information

EE319K Fall 2003 Quiz 1 Page 1

EE319K Fall 2003 Quiz 1 Page 1 EE319K Fall 2003 Quiz 1 Page 1 First: Last: This is a closed book exam. You must put your answers on this piece of paper only. You have 50 minutes, so allocate your time accordingly. Please read the entire

More information

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

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1 Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University What is Assembly Language? Assembly language is a programming language

More information

538 Lecture Notes Week 3

538 Lecture Notes Week 3 538 Lecture Notes Week 3 (Sept. 20, 2017) 1/24 538 Lecture Notes Week 3 Answers to last week's questions 1 Write code so that the least significant bit of Accumulator A is cleared, the most significant

More information

EE319K Fall 2006 Quiz 1 Page 1

EE319K Fall 2006 Quiz 1 Page 1 EE319K Fall 2006 Quiz 1 Page 1 First: Last: This is a closed book exam. You must put your answers on this piece of paper only. You have 50 minutes, so allocate your time accordingly. Please read the entire

More information

Outline. 2.8 Stack. 2.9 Subroutines

Outline. 2.8 Stack. 2.9 Subroutines Outline 21 Assembly language program structure 22 Data transfer instructions 23 Arithmetic instructions 24 Branch and loop instructions 25 Shift and rotate instructions 26 Boolean logic instructions 27

More information

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

Ryerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 2003 Ryerson University Department of Electrical and Computer Engineering ELE 538 Microprocessor Systems Final Examination December 8, 23 Name: Student Number: Time limit: 3 hours Section: Examiners: K Clowes,

More information

EE319K Fall 2005 Quiz 1A Page 1

EE319K Fall 2005 Quiz 1A Page 1 EE319K Fall 2005 Quiz 1A Page 1 First: Last: This is a closed book exam. You must put your answers on this piece of paper only. You have 50 minutes, so allocate your time accordingly. Please read the entire

More information

Coe538 Final Study Guide 2016 (Questions & Answers)

Coe538 Final Study Guide 2016 (Questions & Answers) Coe538 Study Guide 1 of 8 Coe538 Final Study Guide 2016 (Questions & Answers) This version contains questions AND answers. This study guide is meant to help you review coe538 and prepare for the final.

More information

ECE 3610 MICROPROCESSING SYSTEMS

ECE 3610 MICROPROCESSING SYSTEMS 24.361 Lab. 4 31 ECE 3610 MICROPROCESSING SYSTEMS Laboratory 4 LAB 4: ASSEMBLER DIRECTIVES, THE STACK, SUBROUTINES, AND BUBBLE SORTING 1 INTRODUCTION This lab deals with the use of the stack and subroutines

More information

Administrivia. ECE/CS 5780/6780: Embedded System Design. Assembly Language Syntax. Assembly Language Development Process

Administrivia. ECE/CS 5780/6780: Embedded System Design. Assembly Language Syntax. Assembly Language Development Process Administrivia ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 3: Assembly Language Programming 2 versions of CodeWarrior are on the lab machines. You should use the 4.5 version (CW for

More information

ECE/CS 5780/6780: Embedded System Design

ECE/CS 5780/6780: Embedded System Design ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 3: Assembly Language Programming Scott R. Little (Lecture 3: Assembly) ECE/CS 5780/6780 1 / 59 Administrivia 2 versions of CodeWarrior are

More information

Lecture #17 Concurrency Embedded System Engineering Philip Koopman Monday, 21-March-2016 Example application Remote Keyless Entry

Lecture #17 Concurrency Embedded System Engineering Philip Koopman Monday, 21-March-2016 Example application Remote Keyless Entry Lecture #17 Concurrency 18-348 Embedded System Engineering Philip Koopman Monday, 21-March-2016 Electrical& Computer ENGINEERING Copyright 2006-2016, Philip Koopman, All Rights Reserved Example application

More information

Lecture #17 Concurrency Embedded System Engineering Philip Koopman Monday, 21-March-2016

Lecture #17 Concurrency Embedded System Engineering Philip Koopman Monday, 21-March-2016 Lecture #17 Concurrency 18-348 Embedded System Engineering Philip Koopman Monday, 21-March-2016 Electrical& Computer ENGINEERING Copyright 2006-2016, Philip Koopman, All Rights Reserved Example application

More information

Arrays and Strings (2H) Young Won Lim 3/7/18

Arrays and Strings (2H) Young Won Lim 3/7/18 Arrays and Strings (2H) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or

More information

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

UNIVERSITY OF MANITOBA DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING. Term Test #2 Solution ECE 3610 MICROPROCESSING SYSTEMS ECE 3610 Test 2 Solution 1 of 7 PRINT LAST NAME: STUDENT NUMBER PRINT FIRST NAME: UNIVERSITY OF MANITOBA DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING DATE: Feb. 28, 11; TIME: 6:00-8:00 P.M. Term Test

More information

Addressing Mode Description Addressing Mode Source Format Abbrev. Description

Addressing Mode Description Addressing Mode Source Format Abbrev. Description Addressing Mode Description Addressing Mode Source Format Abbrev. Description Inherent INST (no operands) INH Operands (if any) are in CPU registers Immediate INST #opr8i or INST #opr16i IMM Operand is

More information

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.

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. Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3 o Comparison of C and Assembly programs for the HC12 o How to compile a C program using the GNU-C compiler o Using pointers to access

More information

Y = (A + C) (A + B) (B + C)

Y = (A + C) (A + B) (B + C) EEL3701 Dr. Gugel Last Name First Name Spring 2012 Final Quiz UF ID# Open book and open notes, 90-minute examination to be done in non-red pencil or pen. No electronic devices permitted. All work and solutions

More information

Lab 2 Part 1 Assembly Language Programming and 9S12 Ports

Lab 2 Part 1 Assembly Language Programming and 9S12 Ports Lab 2 Part 1 Assembly Language Programming and 9S12 Ports In this sequence of three labs, you will learn how to write simple assembly language programs for the MC9S12 microcontroller, and how to use general

More information

(5) Question 7. Simplified memory cycles (you may or may not need all 5 entries) R/W Addr Data

(5) Question 7. Simplified memory cycles (you may or may not need all 5 entries) R/W Addr Data EE319K Fall 2003 Quiz 3 Page 1 First: Middle Initial: Last: This is a closed book exam. You must put your answers on this piece of paper only. You have 50 minutes, so allocate your time accordingly. Please

More information

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

m 1 se 7 m 23 Introduction to Embedded Microcomputer Systems Lecture 16.1 Recap Finite State Machines Pointer implementation Introduction to Embedded Microcomputer Systems Lecture 16.1 Recap Finite State Machines Pointer implementation Overview Fixed-point: why, when, how Local variables: scope and allocation How these concepts

More information

EE4390 Microprocessors

EE4390 Microprocessors EE4390 Microprocessors Lesson 6,7 Instruction Set, Branch Instructions, Assembler Directives Revised: Aug 1, 2003 1 68HC12 Instruction Set An instruction set is defined as a set of instructions that a

More information

Exam 2 E2-1 Fall Name: Exam 2

Exam 2 E2-1 Fall Name: Exam 2 Exam 2 E2-1 Fall 2002 1. Short Answer [10 pts] Exam 2 a.[2 pts] Briefly describe what each of the following instructions do so that it is clear what the differences between them are: STAA -2,X STAA 2,-X

More information

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

History of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram History of the Microprocessor ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 1: 68HC12 In 1968, Bob Noyce and Gordon Moore left Fairchild Semiconductor and formed Integrated Electronics

More information

Cross Assembly and Program Development

Cross Assembly and Program Development Cross Assembly and ENGG4640/3640; Fall 2004; Prepared by Radu Muresan 1 Introduction Text Editor Program Ex. DOS, Notepad, Word saved as ASCII Source Code Assembler or Cross-Assembler Object Code Machine

More information

Introduction to Embedded Microcomputer Systems Lecture 10.1

Introduction to Embedded Microcomputer Systems Lecture 10.1 Introduction to Embedded Microcomputer Systems Lecture 10.1 Recap Switch, LED interface Real board debugging if-then statements Overview Successive refinement Modular programming Subroutines, parameter

More information

MIGRATING TO THE 68HC12 IN C

MIGRATING TO THE 68HC12 IN C MIGRATING TO THE 68HC12 IN C by Jean-Pierre Lavandier (Cosmic Software) and Greg Viot (Motorola) INTRODUCTION An important design goal of the 68HC12 was to maintain software compatibility with the 68HC11

More information

538 Lecture Notes Week 2

538 Lecture Notes Week 2 538 Lecture Notes Week 2 (Sept. 13, 2017) 1/15 Announcements 538 Lecture Notes Week 2 Labs begin this week. Lab 1 is a one-week lab. Lab 2 (starting next week) is a two-week lab. 1 Answers to last week's

More information

Department of Computer Science and Engineering

Department of Computer Science and Engineering Department of Computer Science and Engineering Instruction Set Overview This is a complete overview of the instruction set for the Motorola MC9S12DT256 microprocessor. Some of the groups are irrelevant

More information

AN Kbyte Addressing with the M68HC11. Overview

AN Kbyte Addressing with the M68HC11. Overview Order this document by /D 128-Kbyte Addressing with the M68HC11 By Ross Mitchell MCU Applications Engineering Freescale Ltd. East Kilbride, Scotland Overview The maximum direct addressing capability of

More information

Disassembly of an HC12 Program It is sometimes useful to be able to convert HC12 op codes into mnemonics. For example, consider the hex code:

Disassembly of an HC12 Program It is sometimes useful to be able to convert HC12 op codes into mnemonics. For example, consider the hex code: Disassembly of an HC12 Program It is sometimes useful to be able to convert HC12 op codes into mnemonics. For example, consider the hex code: ADDR DATA ---- ------------------------------------------------------

More information

Reading Assignment. 68HC12 Instruction Set. M68HC12 Instruction Set Categories. Some Tips. Endianness (Byte Order) Load and Store Instructions

Reading Assignment. 68HC12 Instruction Set. M68HC12 Instruction Set Categories. Some Tips. Endianness (Byte Order) Load and Store Instructions Reading Assignment EEL 4744C: Microprocessor Applications Lecture 5 68HC12 Instruction Set Software and Hardware Engineering (Old version) Chapter 4 Or Software and Hardware Engineering (New version) Chapter

More information

AN1064. Motorola Semiconductor Application Note. Use of Stack Simplifies M68HC11 Programming By Gordon Doughman. Introduction

AN1064. Motorola Semiconductor Application Note. Use of Stack Simplifies M68HC11 Programming By Gordon Doughman. Introduction Order this document by /D Motorola Semiconductor Application Note Use of Stack Simplifies M68HC11 Programming By Gordon Doughman Introduction The architectural extensions of the M6800 incorporated into

More information

CE-320 Microcomputers I Winter 2010 LAB 1: MINIIDE GROUP #: NAME: PARTNER: Lab 1 Page 1

CE-320 Microcomputers I Winter 2010 LAB 1: MINIIDE GROUP #: NAME: PARTNER: Lab 1 Page 1 LAB 1: MINIIDE GROUP #: NAME: PARTNER: Lab 1 Page 1 LAB 1: MINIIDE GOALS Understand Wytec s Dragon12+ evaluation board Know how to use Dragon12 commands Understand an integrated development environment

More information

EE 308 Spring The HCS12 has 6 addressing modes

EE 308 Spring The HCS12 has 6 addressing modes The HCS12 has 6 addressing modes Most of the HC12 s instructions access data in memory There are several ways for the HC12 to determine which address to access Effective Address: Memory address used by

More information

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

Most of the HC12 s instructions access data in memory There are several ways for the HC12 to determine which address to access HC12 Addressing Modes Instruction coding and execution o Inherent, Extended, Direct, Immediate, Indexed, and Relative Modes o Summary of MC9S12 Addressing Modes o Using X and Y registers as pointers o

More information

Module 1-G. Marcos and Structured Programming

Module 1-G. Marcos and Structured Programming Module 1-G Marcos and Structured Programming 1 Learning Outcome #1 An ability to program a microcontroller to perform various tasks How? A. Architecture and Programming Model B. Instruction Set Overview

More information

Exam I Review February 2017

Exam I Review February 2017 Exam I Review February 2017 Binary Number Representations Conversion of binary to hexadecimal and decimal. Convert binary number 1000 1101 to hexadecimal: Make groups of 4 bits to convert to hexadecimal,

More information

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

Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3 Introduction to Programming the 9S12 in C Huang Sections 5.2 and 5.3 o Comparison of C and Assembly programs for the HC12 o How to compile a C program using the GNU-C compiler o Using pointers to access

More information

MACO Multiple Agent Climbing Organism

MACO Multiple Agent Climbing Organism MACO Multiple Agent Climbing Organism Final Report Ted Belser University of Florida, Department of Computer Engineering EEL 5666, Machine Intelligence Design Laboratory Table of Contents MACO... 1 Multiple

More information

Introduction to Embedded Systems. Some Nagging

Introduction to Embedded Systems. Some Nagging Introduction to Embedded Systems CS/ECE 6780/5780 Al Davis Today s topics: some logistics nagging assembly language programming 1 CS 5780 Some Nagging Apparently necessary several students do not yet have

More information

Introduction to Microcontrollers

Introduction to Microcontrollers Motorola M68HC11 Specs Assembly Programming Language BUFFALO Topics of Discussion Microcontrollers M68HC11 Package & Pinouts Accumulators Index Registers Special Registers Memory Map I/O Registers Instruction

More information

The 6502 Instruction Set

The 6502 Instruction Set The 6502 Instruction Set Load and Store Group LDA Load Accumulator N,Z LDX Load X Register N,Z LDY Load Y Register N,Z STA Store Accumulator STX Store X Register STY Store Y Register Arithmetic Group ADC

More information

Test ROM V2 for MPU boards System 3, 4, 6, 7 and corresponding driver boards. Author: André Boot corrections in this document by coinop

Test ROM V2 for MPU boards System 3, 4, 6, 7 and corresponding driver boards. Author: André Boot corrections in this document by coinop Test ROM V2 for MPU boards System 3, 4, 6, 7 and corresponding driver boards Author: André Boot corrections in this document by coinop 1. INTRODUCTION... 2 2. INSTALLATION OF THE BOOT TEST ROM... 3 3.

More information

Mark II Aiken Relay Calculator

Mark II Aiken Relay Calculator 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

More information

ECET Chapter 2, Part 3 of 3

ECET Chapter 2, Part 3 of 3 ECET 310-001 Chapter 2, Part 3 of 3 W. Barnes, 9/2006, rev d. 10/07 Ref. Huang, Han-Way, The HCS12/9S12: An Introduction to Software and Hardware Interfacing, Thomson/Delmar. In This Set of Slides: 1.

More information

EE445L Fall 2010 Final Version A Page 1 of 10

EE445L Fall 2010 Final Version A Page 1 of 10 EE445L Fall 2010 Final Version A Page 1 of 10 Jonathan W. Valvano First: Last: This is the closed book section. You must put your answers in the boxes on this answer page. When you are done, you turn in

More information

Module 1-D. Control Structure Applications. Tim Rogers 2017 [1.D]-1

Module 1-D. Control Structure Applications. Tim Rogers 2017 [1.D]-1 Module 1-D Control Structure Applications Tim Rogers 2017 [1.D]-1 Learning Outcome #1 An ability to program a microcontroller to perform various tasks How? A. Architecture and Programming Model B. Instruction

More information

Motorola HC11. Fun with Microcontrollers and Embedded Systems

Motorola HC11. Fun with Microcontrollers and Embedded Systems Motorola HC11 Fun with Microcontrollers and Embedded Systems Original Source: http://www.soe.ucsc.edu/classes/cmpe012c/winter04/notes/12_microcontrollers.ppt Microcontrollers What is a microcontroller?

More information

What is an Addressing Mode?

What is an Addressing Mode? Addressing Modes 1 2 What is an Addressing Mode? An addressing mode is a way in which an operand is specified in an instruction. There are different ways in which an operand may be specified in an instruction.

More information

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014.

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014. ECE-47/57: Microprocessor-Based System Design Fall 214 Notes - Unit 3 OVERVIEW OF THE HCS12 MICROCONTROLLER The HCS12 is a family of Freescale microcontrollers (MCUs) targeted to automotive and process

More information

EE319K Spring 2010 Exam 1A Page 1

EE319K Spring 2010 Exam 1A Page 1 EE319K Spring 2010 Exam 1A Page 1 First: Last: This is a closed book exam. You must put your answers pages 1,2,3 only. You have 50 minutes, so allocate your time accordingly. Show your work, and put your

More information

EE319K Fall 2010 Exam 1B Page 1

EE319K Fall 2010 Exam 1B Page 1 EE319K Fall 2010 Exam 1B Page 1 First: Last: This is a closed book exam. You must put your answers on pages 1,2,3,4 only. You have 50 minutes, so allocate your time accordingly. Show your work, and put

More information

Total: EEL 3701 Digital Logic & Computer Systems Final Exam Fall Semester 2007 COVER SHEET: Re-Grade Information: 1 (10) 2 (10) 3 (10) 4 (14) 5 (14)

Total: EEL 3701 Digital Logic & Computer Systems Final Exam Fall Semester 2007 COVER SHEET: Re-Grade Information: 1 (10) 2 (10) 3 (10) 4 (14) 5 (14) COVER SHEET: Prob. Points: Re-Grade Information: Total: 1 (10) 2 (10) 3 (10) 4 (14) 5 (14) 6 (15) 7 (15) 8 (12) (100) 1 Remember to show ALL work here and in EVERY problem on this exam. [10%] 1. Circuit

More information

Module 3.F. Serial Communications Interface (SCI) Tim Rogers 2017

Module 3.F. Serial Communications Interface (SCI) Tim Rogers 2017 Module 3.F Serial Communications Interface (SCI) Tim Rogers 2017 Learning Outcome #3 An ability to effectively utilize the wide variety of peripherals integrated into a contemporary microcontroller How?

More information

ECE 3610 MICROPROCESSING SYSTEMS AN ENCRYPTED ASCII CODE DECODER

ECE 3610 MICROPROCESSING SYSTEMS AN ENCRYPTED ASCII CODE DECODER ECE 3610 MICROPROCESSIG SYSTEMS A ECRYPTED ASCII CODE DECODER 1 PROBLEM SPECIFICATIO Design a microprocessing system to decode messages which are encrypted. Each byte of the message is an encrypted ASCII

More information

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

COSC 243. Instruction Sets And Addressing Modes. Lecture 7&8 Instruction Sets and Addressing Modes. COSC 243 (Computer Architecture) COSC 243 Instruction Sets And Addressing Modes 1 Overview This Lecture Source Chapters 12 & 13 (10 th editition) Textbook uses x86 and ARM (we use 6502) Next 2 Lectures Assembly language programming 2

More information

Lecture 7 Assembly Programming: Shift & Logical

Lecture 7 Assembly Programming: Shift & Logical CPE 390: Microprocessor Systems Fall 2017 Lecture 7 Assembly Programming: Shift & Logical Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030

More information

Controlling the QED Digital-to-Analog Converter from within an Interrupt Service Routine

Controlling the QED Digital-to-Analog Converter from within an Interrupt Service Routine Mosaic Industries Controlling the QED Digital-to-Analog Converter from within an Interrupt Service Routine APPLICATION NOTE MI-AN-059 Summary There are times you may want to control the QED Board s digital-to-analog

More information

Introduction. ECE/CS 5780/6780: Embedded System Design. Golden Rule of Software Development. Software Maintenance. Assembly Language Style Issues

Introduction. ECE/CS 5780/6780: Embedded System Design. Golden Rule of Software Development. Software Maintenance. Assembly Language Style Issues Introduction ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 4: Software Design Success of an embedded system project depends on both hardware and software. Real-time embedded systems are

More information