ME 6405 Introduction to Mechatronics

Size: px
Start display at page:

Download "ME 6405 Introduction to Mechatronics"

Transcription

1 ME 6405 Introduction to Mechatronics Fall 2005 Instructor: Professor Charles Ume LECTURE 9

2 Homework 1 Solution 1. Write an assembly language program to clear the usable internal RAM in the M68HC11E9. Solution: Clear Locations $ $002C. ORG $1040 LDX #$0000 LOOP CLR $00,X INX CPX #$002D BNE LOOP SWI END (NOTE: 1. You could have also written this program to clear $0100 to $01FF 2. You should hand-assemble this program.)

3 Homework 1 Solution 2. Write a program to add even/odd numbers located in addresses $0000 through $00FE. Solution: (for adding odd numbers) ORG $1040 LDY #$ CE 0000 LDX #$ CE 0000 IND LDAA #$FF FF LDAB $00,X 1049 E BITB #$01 104B BEQ EVEN 104D ABY 104F 18 3A EVEN INX STX $ FF ST time: #$2001: EORA $ B acc. A: BNE IND ED SWI 105A 3F END OR DECA 4A If you use this, then IND should be moved down to the next line

4 Write an assembly language program to find the largest signed number in a list of numbers stored in address $0020 thru $0029. Repeat for unsigned number. FIRST EQU $0020 LAST EQU $002A ANSWR EQU $0010 ORG $1040 LDX #FIRST LDAA FIRST STAA ANSWR INX Goes with DECB. If DECB is removed, then LDAB #$0A LDAB must be removed NUB LDAA $00,X CMPA ANSWR (A - ANSWR) Branch if accumulator A BLE NEXT; (signed)* *(Branch if zero. is less than ANSWR NEXT OR Branches if 2's complement number in register A was less or equal to the 2's complement number represented by ANSWR) BLS NEXT; (unsigned)** **(Branch if lower or same, i.e, Branch if register A was lower or same as ANSWR) STAA INX CPX BNE SWI END Homework 2 Solution ANSWR #LAST OR DECB NUB

5 Homework 2 Solution Continued Signed Example: #$3F (positive) #$F4 (negative) Un-Signed Example: #$3F (positive) #$F4 (positive) Convert Numbers to Decimal: #$F4 = % 's Comp #$0B = % 's Comp #$0C = % #$F4 = Convert Numbers to Decimal: #$F4 = % #$F4 = #$3F = % #$3F = #$3F = % #$3F = #$F4 is larger than #$3F since is larger than #$3F is larger than #$F4 since is larger than

6 Homework Homework 3 Write a sample program to output a string of characters to the screen. Write a subroutine to save the first 5 odd (8-bit) numbers pointed to by the x-register (passed in) onto the stack. Homework 4 Write a program to output a square wave thru port D pin 2. The output can be observed on the scope, and the period T of the wave should be measured. More than one period wave should be generated. The machine cycle time of the M68HC11E9 should be estimated. Draw the square wave.

7

8 ASCII Character Codes ASCII American Standard Code for Information Interchange ASCII assigns a hexadecimal code to individual characters Examples: Character ASCII A $41 E $45 e $65 (Note: Different codes for lower and upper case) 1 $31 BS $08 (Note: BS is Backspace. ) A microcontroller must send these codes to a display terminal in order for the terminal to display them

9 ASCII Character Codes (continued) Hex to ASCII Conversion table from Programming Reference Guide Page 58

10 ASCII Character Codes An array of characters is called a string Example: character array String ASCII Representation H e l l o Hello $48 $65 $6C $6C $6F (Note: Character ASCII H $48 e $65 l $6C o $6F )

11

12 Assembly Directive Types Assembly Control ORG, END Symbol Definition EQU Data Definition/Storage Allocation FCC, FCB, FDB, RMB, ZMB, BSZ, FILL Listing Control PAGE, OPT

13 Assembly Control

14 ORG and END ORG : Store translated machine language instructions in sequence starting at given address for any mnemonic instructions that follow END: Stop translating mnemonics instructions until another ORG is encountered (Note: These were already discussed in Lecture 7)

15 Symbol Definition

16 EQU EQU lets you refer to a number or an address as a variable name. Example: VALA EQU $10 *LABEL VALA USED TO REFER TO $10 ORG $1040 LDAA #VALA *LOAD HEX NUMBER $10 IN ACCUMULATOR A LDAB VALA *LOAD CONTENT OF MEMORY LOCATION $10 *IN ACC. B SWI END Same As: VALA EQU $10 *LABEL VALA USED TO REFER TO $10 ORG $1040 LDAA #$10 *LOAD HEX NUMBER $10 IN ACCUMULATOR A LDAB $10 *LOAD CONTENT OF MEMORY *LOCATION $10 IN ACC. B SWI George END W. Woodruff School of Mechanical Engineering, Georgia Tech

17 Data Definition/Storage Allocation

18 FCC FCC Form Constant Character string FCC stores ASCII characters into consecutive bytes of memory. Any printable ASCII characters can be contained in the string. String is specified between two identical delimiters, which can be any printable ASCII character. First non-blank character after the string is used as a delimiter.

19 FCC Cont d Result Example: ORG $00 FCC Address Prebyte Opcode Operand $00 $01 $02 $03 $

20 FCB FCB Form Constant Byte FCB has one or more operands. Value of each operand is truncated to eight bits, and is stored in single byte of object program. Operand may be a numeric constant, character constant, a symbol or an expression. Multiple operands are separated by commas, and are stored in successive memory bytes.

21 FCB Cont d Example: VALA EQU $10 ORG $00 FCB $34, A, $28AC, $0A,VALA Result Address Prebyte Opcode Operand $00 $01 $02 $ AC 0A $04 10

22 FDB FDB Form Constant Double Byte FDB stores a double (two byte) word. May have one or more operands separated by commas. Operand may be a numeric constant, a character constant, a symbol, or an expression.

23 FDB Cont d Example: ORG $00 FDB $1234, &, G Note: ASCII value for & is $26 ASCII value for G is $47 Result Address Prebyte Opcode Operand $00 $01 $02 $03 $04 $

24 RMB RMB Reserve Memory Byte RMB saves a place in memory for a number. Example: ORG $00 XVAR RMB 2 *TWO MEMORY ORG $1040 LDD #$FFAA STD XVAR SWI END *LOCATIONS $00 *and $01 ARE *RESERVED FOR XVAR $00 $01 Result Address Prebyte Opcode Operand FF AA

25 Question a student asked: What happens if you change the previous example to "XVAR RMB 3" instead of "XVAR RMB 2"? What happens to the 3rd reserved byte when a 2 byte number is stored in XVAR? Answer: Remains unchanged Modified Program: ORG $00 XVAR RMB 3 ORG $1040 LDD #$FFAA STD XVAR SWI END

26 ZMB, BSZ ZMB Zero Memory Byte and BSZ Block Storage of Zero These directives fill a given number of memory locations with zero. Causes assembler to allocate a block of memory bytes, and each memory byte is assigned a value of zero. Both directives do the same thing. Number of bytes allocated is given in the operand field. Example: ORG $00 ZMB #$02 BSZ #$02 Address Prebyte Opcode Operand $00 $01 $02 $03 Result

27 FILL Fill given number of memory locations with any number. (Note: Fill uses one byte. If two bytes are specified, then it will truncate it and use LS Byte.) Example: ORG $00 FILL #$FF, #$02 $00 $01 Result Address Prebyte Opcode Operand FF FF

28 Modified Example: Question a student asked: What happens when the previous example is changed to "FILL #$9ABC, #$02" instead of "FILL #$FF,#$02"? What happens if you fill memory with a 2 byte number? ORG $00 FILL #$9ABC,#$02 END Answer: FILL will just use the LS Byte (Note: George There W. is Woodruff no "Go 1040 School on of the Mechanical screen since Engineering, these are Georgia just assembly Tech directives and not a program)

29 Listing Control

30 PAGE PAGE The PAGE directive causes a page break in the list file. If no source listing is being produced, the PAGE directive will have no effect. The directive is not printed on the source listing.

31 OPT OPT Allows for various options in assembly of a program, including generating a listing and counting instruction cycles. Options: nol-no output listing (default) l-do an output listing noc-no cycle number count (default) c-turn on cycle count using zero initial value contc-turn cycle count on, begin with last value cre-create a cross reference table (default anyway) RMB s-create a symbol table (default anyway) EQU Example: OPT l Print source listing from this point

32 Buffalo Monitor Utility Subroutines

33 Buffalo Monitor Utility Subroutines Buffalo Monitor Utility Subroutines These subroutines are available for performing I/O tasks. A jump table has been set up in ROM directly beneath the interrupt vectors. To use these subroutines, execute a jump to subroutine (JSR) command to the appropriate entry in the jump table.

34 UPCASE WCHEK DCHEK INIT INPUT OUTPUT OUTLHLF OUTRHLF Subroutine Listing If character in accumulator A is lower case alpha, convert to upper case. Test character in accumulator A and return with Z bit set if character is whitespace (space, comma, tab). Test character in accumulator A and return with Z bit set if character is delimiter (carriage return or whitespace). Initialize I/O device. Read I/O device. Write I/O device. Convert left nibble of accumulator A contents to ASCII and output to terminal port. Convert right nibble of accumulator A contents to ASCII and output to terminal port.

35 Subroutine Listing Cont d OUTA OUT1BYT OUT1BSP OUT2BSP Output accumulator A ASCII character. Convert binary byte at address in index register X to two ASCII characters and output. Return address in index register X pointing to next byte. Convert binary byte at address in index register X to two ASCII characters and output followed by a space. Returns address in index register. Convert two consecutive binary bytes starting at address in index X to four ASCII characters and output followed by a space. Returns address in index register X pointing to next byte. OUTCCRLF Output ASCII carriage return followed by a line feed. OUTSTRG Output string of ASCII bytes pointed to by address in index register X until character is an end of transmission ($04). OUTSTRGO Same as OUTSTRG except leading carriage return and line feed is skipped. INCHAR Waits for you to type an ASCII character from the keyboard, and stores George the W. Woodruff corresponding School ASCII of Mechanical number Engineering, accumulator Georgia A, and Tech then outputs the ASCII character to the screen.

36 To use an I/O subroutine, Jump Sub Routine (JSR) to the specified address listed below. ADDRESS SUBROUTINE FUNCTION $FFAO UPCASE Convert character to uppercase $FFA3 WCHEK Test character for whitespace $FFA6 DCHEK Check character for delimiter $FFA9 INIT Initialize I/O device $FFAC INPUT Read I/O device $FFAF OUTPUT Write I/O device $FFB2 OUTLHLF Convert left nibble to ASCII and output $FFB5 OUTRHLF Convert right nibble to ASCII and output $FFB8 OUTA Output ASCII character $FFBB OUTlBYT Convert binary byte to 2 ASCII characters and output $FFBE OUT1BSP Convert binary byte to 2 ASCII characters and output followed by space $FFCl OUT2BSP Convert 2 consecutive binary bytes to 4 ASCII characters and output followed by space. $FFC4 OUTCRLF Output ASCII carriage return followed by line feed $FFC7 OUTSTRG Output ASCII string until end of transmission ($04) $FFCA OUTSTRGO Same as OUTSTRG except leading carriage return and line feed is skipped $FFCD INCHAR Input ASCII character and echo back

37 Utility Subroutines Examples Example: OUTA ORG $1040 LDAA #$41 JSR $FFB8 SWI END *Load acc. A with ASCII code for the *character A. *JSR to the subroutine OUTA Result A is written to the screen.

38 Example: OUTSTRG (Out String) STR1 EQU $2100 OUTSTRG Utility Subroutines Examples EQU $FFC7 ORG STR1 FCC ABCDEFG FCB #$04 ORG $1040 LDX #STR1 JSR OUTSTRG SWI END Result ABCDEFG written to the screen on a new line. *Go to OUTSTRG routine which *outputs ASCII characters contained in each *address starting from $2100 until *an EOT character is found. (Note: ASCII end of transmission (EOT) character must be used with the OUTSTRG subroutine to let it know when to stop reading from memory. EOT ASCII = #$04)

39 Difference Between the Utility Subroutines OUTSTRG and OUTSTRG0 Assume you want to print the following to the screen: MEMORY LOCATION $ CONTAINS IN DECIMAL. Use subroutine OUTSTRG to print MEMORY LOCATION $ to screen on a new line (It always starts printing on a new line, because it outputs carriage return with line feed). Use subroutine OUTSTRG0 to print CONTAINS to screen on same line as MEMORY LOCATION $ (Because it does not output carriage return with line feed) Use subroutine OUTSTRG0 to print IN DECIMAL. to screen on the same line (Note: Refer to Lab website for example program to print decimal numbers to the screen.)

40 Utility Subroutines Examples Example: OUTLHLF (Out Left Half) and OUTRHLF (Out Right Half) ORG $1040 LDAA #$AF JSR $FFB2 JSR $FFB5 SWI END *Puts hex number $AF in acc. A *Goes to subroutine OUTLHLF which converts left *nibble, #$A, to ASCII number, $41, and then outputs *its ASCII character, A, to the screen. *Goes to subroutine OUTRHLF which converts right *nibble, #$F, to ASCII number, $46, and then outputs *its ASCII character, F, to the screen. Result AF is written to the screen.

41 Utility Subroutines Examples Example: OUT1BYT (Out 1 Byte) and OUT1BSP (Out 1 Byte with Space) Assume that memory contains the following: 2100 FA FB Now execute the following code: ORG $1040 LDX #$2100 JSR $FFBB JSR $FFBE SWI END *Goes to subroutine OUT1BYT which converts the *content of the address pointed to by the X register to *two ASCII equivalents and outputs their characters to *the screen, and increments X register by #$1. *Goes to subroutine OUT1BSP which converts the *content of the address pointed to by the X register to *two ASCII equivalents and outputs their characters to the *screen followed by a space. Result FAFB_ sent to screen (Note: last character is a space)

42 Utility Subroutines Examples Example: OUT2BSP (Out 2 Bytes with Space) Assume that memory contains the following: 2100 FA FB Now execute the following code. ORG $1040 LDX #$2100 JSR $FFC1 SWI END *JSR to subroutine OUT2BSP which converts two *consecutive binary bytes to their 4 ASCII numbers *and outputs their ASCII characters to the screen followed by a *space. Result FAFB_ sent to screen (last character is a space).

43 Utility Subroutines Examples Example: OUTCRLF (Output Carriage Return with Line Feed) ORG $1040 JSR $FFC4 SWI END *Go to subroutine OUTCRLF *which outputs ASCII carriage return *followed by a line feed. Result New line on screen (Note:Equivalent to pressing Enter in your computer)

44 Utility Subroutines Examples Example: INCHAR (Input Character) ORG $1040 JSR $FFCD SWI END *Goes to subroutine INCHAR. Waits for you to *type an ASCII character from the keyboard, *and stores the corresponding ASCII number in *accumulator A Result-> If you type 9 on the keyboard, ASCII number $39 is stored in accumulator A

45 Homework 3 Solution Write an assembly language program to output a string of characters to the screen. Solution: This particular solution will print Hello to the screen using the OUTA subroutine OUTA EQU $FFB8 ORG $0100 FCC HELLO FCB #$04 ORG $1040 LDX #$0100 Loop LDAA $00,X CMPA #$04 BEQ Quit JSR OUTA; INX BRA Loop Quit SWI END FCC is used to store a string of characters FCB is used to store End Of Transmission (EOT) (Note: EOT in ASCII is $04) (Note 2: In this particular example any non-printing character can be used)

46 CPU Registers Used in Program: Program Skip Ahead Initialization Until Last Loop OUTA EQU $FFB8 Accum A: Index X: CCR Bit Z: $0100 $0101 $0102 $0103 $0104 #$04 #$48 #$65 #$6F #$1005 #$0100 #$0101 #$0102 Memory Locations Used in Program: 10 $48 $65 $6C $6C $6F CCR Z is 1 since Accum A equals $04 CCR Z is 0 since Accum A does ORG $0100 FCC Hello FCB #$04 not equal $04 ORG $1040 LDX #$0100 Loop LDAA $00,X CMPA #$04 BEQ Quit JSR OUTA INX Hello BRA SWI END Ascii Quit Equivalent of Hello Computer Screen: Loop Branch since Does not branch CCR Z is 1 because CCR Always Z is 0 Branches $0105 George W. $04Woodruff School of Mechanical Engineering, Georgia Tech

47 Solution 2: This particular solution will print Hello to the screen using the OUTSTRG subroutine OUTSTRG EQU $FFC7 ORG $0100 FCC HELLO FCB #$04 (Note: EOT must be used because the OUTSTRG Subroutine uses EOT as the end of the string) ORG $1040 LDX #$0100 JSR OUTSTRG SWI END

48 Homework 3 Solution Write a subroutine to save the first 5 odd (8-bit) numbers pointed to by the x-register (passed in) onto the stack. Solution: SUB1 LDAA #$05 PULY NEXT BRSET $00,X #$01 ODD INX BRA NEXT ODD LDAB $00,X PSHB INX DECA BNE PSHY RTS NEXT Note: In order for the subroutine to execute, in the main program, a BSR (branch to subroutine) or JSR (jump to subroutine) command must be used in the main George program. W. Woodruff School of Mechanical Engineering, Georgia Tech

49 Homework 4 solution Write a program to output a square wave thru port D pin 2. The output can be observed on the scope, and the period T of the wave should be measured. More than one period wave should be generated. The machine cycle time of the M68HC11E9 should be estimated. Draw the square wave.

50 Solution: ORG $1040 FCB $XX FCB $04 LDAA #$04 STAA $1009 LDAB #$04 CYCLE LDAA $ STAA $ EORA #$04 2 STAA $ LDAA $ NEXT DECA 2 BNE NEXT 3 DECB 2 BEQ EXIT 3 JMP CYCLE 3 EXIT SWI END Homework 4 Solution Cont d Address Prebyte Opcode Operand 1040 XX B C B C B F B B A FD 105A 5A 105B D 7E F 3F Configures PD2 as output. Helps us to output two periods. Outputs signal from PD2 Switch $1041(toggle) Delay T/2=Machine Cycle Time*[4+4+2+COUNT*(2+3) ] (Note: Count = #$XX)

51 QUESTIONS???

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

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

TEMPERATURE SENSOR. Revision Class. Instructor / Professor LICENSE

TEMPERATURE SENSOR. Revision Class. Instructor / Professor LICENSE CME-11E9 EVBU LAB EXPERIMENT TEMPERATURE SENSOR Revision 04.02.11 Class Instructor / Professor LICENSE You may use, copy, modify and distribute this document freely as long as you include this license

More information

BUFFALO MONITOR for HC11 Development Boards

BUFFALO MONITOR for HC11 Development Boards BUFFALO MONITOR for HC11 Development Boards START-UP...2 PROGRAM...2 OPERATING PROCEDURES...2 COMMAND LINE FORMAT...3 MONITOR COMMANDS...4 ASM...6 BF - Block Fill...8 Breakpoint Set - BR...9 BULK ERASE

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

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

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

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

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

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

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

POTENTIOMETER. Revision Class. Instructor / Professor LICENSE

POTENTIOMETER. Revision Class. Instructor / Professor LICENSE CME-11E9 EVBU LAB EXPERIMENT POTENTIOMETER Revision 03.11.13 Class Instructor / Professor LICENSE You may use, copy, modify and distribute this document freely as long as you include this license and the

More information

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

ME 4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 6 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume LECTURE 6 MC9S12C Microcontroller Covered in Lecture 5: Quick Introduction

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

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

Macro Assembler. Defini3on from h6p://www.computeruser.com

Macro Assembler. Defini3on from h6p://www.computeruser.com The Macro Assembler Macro Assembler Defini3on from h6p://www.computeruser.com A program that translates assembly language instruc3ons into machine code and which the programmer can use to define macro

More information

Programming Book for 6809 Microprocessor Kit

Programming Book for 6809 Microprocessor Kit Programming Book for 6809 Microprocessor Kit Wichit Sirichote, wichit.sirichote@gmail.com Image By Konstantin Lanzet - CPU collection Konstantin Lanzet, CC BY-SA 3.0, Rev1.2 March 2018 1 Contents Lab 1

More information

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

Introduction to Mechatronics. Fall Instructor: Professor Charles Ume. Interrupts and Resets ME645 Introduction to Mechatronics Fall 24 Instructor: Professor Charles Ume Interrupts and Resets Reason for Interrupts You might want instructions executed immediately after internal request and/or request

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

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

An ability to program a microcontroller to perform various tasks

An ability to program a microcontroller to perform various tasks Learning Outcome #1 An ability to program a microcontroller to perform various tasks How? A. Architecture and Programming Model B. Instruction Set Overview C. Assembly Control Structures D. Control Structure

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

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

MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes o Review of Addressing Modes o Which branch instruction to use (signed vs unsigned) o Using X and Y registers

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

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

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

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

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers o How to disassemble an MC9S12 instruction sequence o Binary numbers are a code and represent what the programmer intends for the

More information

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers

Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers Disassembly of MC9S12 op codes Decimal, Hexadecimal and Binary Numbers o How to disassemble an MC9S12 instruction sequence o Binary numbers are a code and represent what the programmer intends for the

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

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

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

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

EE319 K Lecture 3. Introduction to the 9S12 Lab 1 Discussion Using the TExaS simulator. University of Texas ECE 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

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

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

CMPEN 472 Sample EXAM II

CMPEN 472 Sample EXAM II CMPEN 472 Sample EXAM II Name: Student ID number (last 4 digit): Please write your name on every page. Write your solutions clearly. You may use backside of each page for scratch but the solutions must

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

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

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

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

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

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

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

2. Arithmetic Instructions addition, subtraction, multiplication, divison (HCS12 Core Users Guide, Sections 4.3.4, and ). AS12 Assembler Directives A Summary of 9S12 instructions Disassembly of 9S12 op codes Huang Section 1.8, Chapter 2 MC9S12 V1.5 Core User Guide Version 1.2, Section 12 o A labels is a name assigned the

More information

Wed. Sept 6 Announcements

Wed. Sept 6 Announcements Wed. Sept 6 Announcements HW 3 / Lab 3 posted [1.C]-1 Endianness Problem: Memory is byte addressed. Sometimes you want to access multi-byte values (16-bit, 32-bits etc.) X is 2-bytes Addr Memory Value

More information

538 Lecture Notes Week 5

538 Lecture Notes Week 5 538 Lecture Notes Week 5 (October 4, 2017) 1/18 538 Lecture Notes Week 5 Announements Midterm: Tuesday, October 25 Answers to last week's questions 1. With the diagram shown for a port (single bit), what

More information

538 Lecture Notes Week 5

538 Lecture Notes Week 5 538 Lecture Notes Week 5 (Sept. 30, 2013) 1/15 538 Lecture Notes Week 5 Answers to last week's questions 1. With the diagram shown for a port (single bit), what happens if the Direction Register is read?

More information

MOTOROLA FREEWARE 8-BIT CROSS ASSEMBLERS USER'S MANUAL EDITED BY KEVIN ANDERSON FIELD APPLICATIONS ENGINEER

MOTOROLA FREEWARE 8-BIT CROSS ASSEMBLERS USER'S MANUAL EDITED BY KEVIN ANDERSON FIELD APPLICATIONS ENGINEER MOTOROLA FREEWARE 8-BIT CROSS ASSEMBLERS USER'S MANUAL EDITED BY KEVIN ANDERSON FIELD APPLICATIONS ENGINEER TABLE OF CONTENTS CHAPTER 1... 1 1.1 INTRODUCTION... 1 1.2 ASSEMBLY LANGUAGE... 1 1.3 OPERATING

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

Example Programs for 6502 Microprocessor Kit

Example Programs for 6502 Microprocessor Kit Example Programs for 6502 Microprocessor Kit 0001 0000 0002 0000 GPIO1.EQU $8000 0003 0000 0004 0000 0005 0200.ORG $200 0006 0200 0007 0200 A5 00 LDA $0 0008 0202 8D 00 80 STA $GPIO1 0009 0205 00 BRK 0010

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

ECE3120: Computer Systems Hardware & Software Development Tools

ECE3120: Computer Systems Hardware & Software Development Tools ECE3120: Computer Systems Hardware & Software Development Tools Manjeera Jeedigunta http://blogs.cae.tntech.edu/msjeedigun21 Email: msjeedigun21@tntech.edu Tel: 931-372-6181, Prescott Hall 120 Using the

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

HC11 Instruction Set Architecture

HC11 Instruction Set Architecture HC11 Instruction Set Architecture High-level HC11 architecture Interrupt logic MEMORY Timer and counter M8601 CPU core Serial I/O A/D converter Port A Port B Port C Port D Port E CMPE12 Summer 2009 16-2

More information

HC11 Instruction Set Architecture

HC11 Instruction Set Architecture HC11 Instruction Set Architecture Summer 2008 High-level HC11 architecture Interrupt logic MEMORY Timer and counter M8601 CPU core Serial I/O A/D converter Port A Port B Port C Port D Port E CMPE12 Summer

More information

PUSH BUTTON. Revision Class. Instructor / Professor LICENSE

PUSH BUTTON. Revision Class. Instructor / Professor LICENSE CME-11E9 EVBU LAB EXPERIMENT PUSH BUTTON Revision 04.02.11 Class Instructor / Professor LICENSE You may use, copy, modify and distribute this document freely as long as you include this license and the

More information

NAM M6800 DISK-BUG DS VER 3.5 OPT PAG

NAM M6800 DISK-BUG DS VER 3.5 OPT PAG NAM M6800 DISK-BUG DS VER 3.5 OPT PAG Floppy Disk Controller Debug Monitor Written 27 Aug 1980 Michael Holley Record of modifications 18 OCT 1981 Disk routines DC-1 23 JAN 1982 Command Table 8 MAY 1982

More information

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

Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my... Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my... See examples on web: DirAddr.asm, ExtAddr.asm, IndAddr.asm,

More information

ECE L A B 1 Introduction ASSEMBLY PROGRAMMING WITH MINIIDE

ECE L A B 1 Introduction ASSEMBLY PROGRAMMING WITH MINIIDE L A B 1 Introduction ASSEMBLY PROGRAMMING WITH MINIIDE The purpose of this lab is to introduce you to the layout and structure of Assembly Language programs and their format. You will write your own programs

More information

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

EE319 K Lecture 7. Address mode review Assembler, Debugging Psuedo ops 16 bit timer finite state machines. University of Texas ECE EE319 K Lecture 7 Address mode review Assembler, Debugging Psuedo ops 16 bit timer finite state machines University of Texas ECE Texas and execution A $24 EEPROM $F800 $F801 $86 $F802 $24 $F803 }ldaa #36

More information

BINARY LOAD AND PUNCH

BINARY LOAD AND PUNCH BINARY LOAD AND PUNCH To easily decrease the amount of time it takes to load a long tape (Cassette or paper) a BINARY formatting technique can be used instead of the conventional ASCII format used by the

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

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

0b) [2] Can you name 2 people form technical support services (stockroom)? ECE 372 1 st Midterm ECE 372 Midterm Exam Fall 2004 In this exam only pencil/pen are allowed. Please write your name on the front page. If you unstaple the papers write your name on the loose papers also.

More information

instruction 1 Fri Oct 13 13:05:

instruction 1 Fri Oct 13 13:05: instruction Fri Oct :0:0. Introduction SECTION INSTRUCTION SET This section describes the aressing modes and instruction types.. Aressing Modes The CPU uses eight aressing modes for flexibility in accessing

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

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

EMCH 367 Fundamentals of Microcontrollers Example_Sort EXAMPLE SORT

EMCH 367 Fundamentals of Microcontrollers Example_Sort EXAMPLE SORT OBJECTIVE This example has the following objectives: EXAMPLE SORT Review the use of keystroke commands for controlling a process Introduce the concept of multiple sort and its sequential sort equivalent

More information

Getting Started with the HCS12 IDE

Getting Started with the HCS12 IDE Getting Started with the HCS12 IDE B. Ackland June 2015 This document provides basic instructions for installing and using the MiniIDE Integrated Development Environment and the Java based HCS12 simulator.

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

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

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

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

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

Chapter 4: Advanced Assembly Programming. EE383: Introduction to Embedded Systems University of Kentucky. Samir Rawashdeh Chapter 4: Advanced Assembly Programming EE383: Introduction to Embedded Systems University of Kentucky Samir Rawashdeh With slides based on material by H Huang Delmar Cengage Learning Chapter Summery

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

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

EB301. Motorola Semiconductor Engineering Bulletin. Programming EEPROM on the MC68HC811E2 during Program Execution. Freescale Semiconductor, I

EB301. Motorola Semiconductor Engineering Bulletin. Programming EEPROM on the MC68HC811E2 during Program Execution. Freescale Semiconductor, I Order this document by /D Motorola Semiconductor Programming EEPROM on the MC68HC811E2 during Program Execution By Brian Scott Crow Austin, Texas Introduction The Problem The MC68HC811E2 microcontroller

More information

AN1742. Programming the 68HC705J1A In-Circuit By Chris Falk CSG Product Engineering Austin, Texas. Introduction. Overview

AN1742. Programming the 68HC705J1A In-Circuit By Chris Falk CSG Product Engineering Austin, Texas. Introduction. Overview Order this document by /D Programming the 68HC705J1A In-Circuit By Chris Falk CSG Product Engineering Austin, Texas Introduction Overview This application note describes how a user can program the 68HC705J1A

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

SWTPC 6800/CT-1024/AC-30 Cassette Tape

SWTPC 6800/CT-1024/AC-30 Cassette Tape SWTPC 6800/CT-1024/AC-30 Cassette Tape Diagnostic Programs These two diagnostic programs have been written to generate and verify respectively cassette tapes generated on the SWTPC 6800 Computer System

More information

ECE 331: PC Lab 3 Stack and Subroutines

ECE 331: PC Lab 3 Stack and Subroutines ECE 331: PC Lab 3 Stack and Subroutines Professor Andrew Mason Michigan State University Rev: S11 p.1 Announcements Objectives Topics Outline Review starting and using ASM development environment Pushing

More information

CET335 Microprocessor Interfacing Lab 5: LCD Interface (Bus Attached Peripheral)

CET335 Microprocessor Interfacing Lab 5: LCD Interface (Bus Attached Peripheral) CET335 Microprocessor Interfacing Lab 5: LCD Interface (Bus Attached Peripheral) Introduction: In this lab, you will learn the interface and operation of a bus-attached peripheral; in other words, a controller

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

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

CHAPTER 8. Solutions for Exercises

CHAPTER 8. Solutions for Exercises CHAPTER 8 Solutions for Exercises E8.1 The number of bits in the memory addresses is the same as the address bus width, which is 20. Thus the number of unique addresses is 2 20 = 1,048,576 = 1024 1024

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

Lecture 5 Assembly Programming: Arithmetic

Lecture 5 Assembly Programming: Arithmetic CPE 390: Microprocessor Systems Spring 2018 Lecture 5 Assembly Programming: Arithmetic Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030

More information

BRANCH IF REGISTER IS HIGHER/GREATHER/ THAN OPERAND e.g. CMPA #$D0

BRANCH IF REGISTER IS HIGHER/GREATHER/ THAN OPERAND e.g. CMPA #$D0 Midterm Review 1. Branch instructions BHI (unsigned), BGT (signed) Take a look at the preceding comparison instruction. Then, you can use this instead of using complex formula in the instruction reference.

More information

Introduction to Microcontrollers II

Introduction to Microcontrollers II Introduction to Microcontrollers II brset, brclr Indexed Addressing Example µp Laboratory #2 BUFFALO Assembling Code EECE 143 Digital Design Project Purpose: To allow students to design their own digital

More information

ECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays

ECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays Assembly Programming Arrays Assembly Programming Arrays Array For Loop Example: unsigned short a[]; for(j=; j

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

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

538 Lecture Notes Week 1

538 Lecture Notes Week 1 538 Clowes Lecture Notes Week 1 (Sept. 6, 2017) 1/10 538 Lecture Notes Week 1 Announcements No labs this week. Labs begin the week of September 11, 2017. My email: kclowes@ryerson.ca Counselling hours:

More information

Introduction to Computers - Chapter 4

Introduction to Computers - Chapter 4 Introduction to Computers - Chapter 4 Since the invention of the transistor and the first digital computer of the 1940s, computers have been increasing in complexity and performance; however, their overall

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

COSC345 Software Engineering. Basic Computer Architecture and The Stack

COSC345 Software Engineering. Basic Computer Architecture and The Stack COSC345 Software Engineering Basic Computer Architecture and The Stack Outline Architectural models A little about the 68HC11 Memory map Registers A little bit of assembly (never did us any harm) The program

More information

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

UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING. Principles of Computer Operation UNIVERSITY OF HONG KONG DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING Experiment PCO: Principles of Computer Operation Location: Part I Lab., CYC 102. Objective: The objective is to learn the basic

More information

Chapter 2 HCS12 Assembly Language

Chapter 2 HCS12 Assembly Language Chapter 2 HCS12 Assembly Language ECE 3120 Dr. Mohamed Mahmoud http://iweb.tntech.edu/mmahmoud/ mmahmoud@tntech.edu Outline 2.1 Assembly language program structure 2.2 Data transfer instructions 2.3 Arithmetic

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

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

ME 4447 / ME 6405: Introduction to Mechatronics

ME 4447 / ME 6405: Introduction to Mechatronics ME 4447 / ME 6405: Introduction to Mechatronics Interrupts and Resets Rohan Bansal Edward Chyau Anirudh Rudraraju Interrupts and Resets 1 Telephone Analogy How do we know if someone is calling? Use polling

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