George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.

Slides:



Advertisements
Similar presentations
Computer Science 210 Computer Organization Strings, I/O, and Trap Service Routines.
Advertisements

1 System Calls (TRAPS) and Subroutines Patt and Patel Ch. 9.
Programming 68HC11.
ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Lab6 – Debug Assembly Language Lab
68HC11 Polling and Interrupts
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
1 Lab Session-IV CSIT-120 Spring 2001 Lab 3 Revision and Exercises Rev: Precedence Rules Lab Exercise 4-A Machine Language Programming The “Micro” Machine.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
EET 2261 Unit 2 HCS12 Architecture
© 2010 Kettering University, All rights reserved..
Assembly & Machine Languages
ICS312 Set 4 Program Structure. Outline for a SMALL Model Program Note the quiz at the next lecture will be to reproduce this slide.MODEL SMALL.586 ;
Lab 1 – Assembly Language and Interfacing Start date: Week 3 Due date: Week 4 1.
CPS120: Introduction to Computer Science
Assembly Language Programming for the MC68HC11. Assembly language programming  Recall the 4 design levels for software development: – Application – High.
P.1ECE 331, Prof. A. Mason Professor Andrew Mason Michigan State University Spring 2013 ECE 331: PC Lab 1: Using HC12 ASM Simulators.
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
BIOS and DOS Programming in DOS INT 10 and 21H. Interrupts There are some extremely useful subroutines within BIOS or DOS that are available to the user.
Microcode Source: Digital Computer Electronics (Malvino and Brown)
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Practical Session 11 Computer Architecture and Assembly Language Input &Output (I/O)
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
ELE22MIC Lecture 8 ASll Examples –16 Bit Counters –Buffalo Jump Table Interrupt processing (IRQ/RTI) Stack Frame & Base Pointer Wired OR.
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
21/11/2005CAP2411 Input & Output Instructions CPU communicates with the peripherals through I/O registers called I/O ports. There are 2 instructions, IN.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
1 Stacks, Subroutines, I/O Routines Today: First Hour: Stacks, Subroutines –Section 3.9,3.10 of Huang’s Textbook –In-class Activity #1 Second Hour: I/O.
1 ECE 372 – Microcontroller Design Assembly Programming HCS12 Assembly Programming Addressing Modes Stack Operations Subroutines.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Ch.2 Intro. To Assembly Language Programming From Introduction to Embedded Systems: Interfacing to the Freescale 9s12 by Valvano, published by CENGAGE.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
© 2010 Kettering University, All rights reserved..
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Embedded Systems Lecture 5 January 25 th, 2016.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Practical Session 11 Computer Architecture and Assembly Language Input &Output (I/O)
ECE 3430 – Intro to Microcomputer Systems
Addressing Modes in Microprocessors
Computer Science 210 Computer Organization
ECE 3430 – Intro to Microcomputer Systems
Learning Outcome #1 Architecture and Programming Model
PROGRAMMING THE BASIC COMPUTER
Computer Science 210 Computer Organization
Introduction to 8085 Instructions
“Assembly Table Lookup”
Branching and Looping Lecture L3.2.
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME4447/6405 Microprocessor Control of Manufacturing Systems and
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
Operating Systems Chapter 5: Input/Output Management
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Computer Architecture and Assembly Language
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Chapter 6 Programming the basic computer
The .ASCII and .END Assembler Input ;Stan Warford ;January 13, 2005
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
Accum A: Index X: CCR Bit Z: $0100 $0101 $0102 $0103 $0104 $0105
ECE511: Digital System & Microprocessor
Presentation transcript:

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume Lecture #11

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 MON12 Utility Subroutines

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 MON12 Utility Subroutines Subroutines are available for performing I/O tasks. Jump table has been set up in EEPROM beneath interrupt vectors. To use these jump subroutines, execute jump to subroutine (JSR) command to appropriate entry in jump table.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Subroutine Listing UPCASE If character in accumulator A is lower case alpha, convert to upper case. WCHEK Test character in accumulator A and return with Z bit set if character is whitespace (space, comma, tab). DCHEKTest character in accumulator A and return with Z bit set if character is delimiter (carriage return or whitespace). ONSCIOInitialize I/O device. INPUTRead I/O device. OUTPUTWrite I/O device. OUTLHLFConvert left nibble of accumulator A contents to ASCII and output to terminal port. OUTRHLFConvert right nibble of accumulator A contents to ASCII and output to terminal port.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Subroutine Listing Cont’d OUTA Output accumulator A ASCII character. OUT1BYT 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. OUT1BSP Convert binary byte at address in index register X to two ASCII characters and output followed by a space. Returns address in index register. OUT2BSP 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). OUTSTRGOSame as OUTSTRG except leading carriage return and line feed is skipped. INCHARWaits for you to type an ASCII character from the keyboard, and stores the corresponding ASCII number in accumulator A, and then outputs the ASCII character to the screen.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 $FF37 UPCASE Convert character to uppercase $FF3A WCHEK Test character for whitespace $FF3D DCHEK Check character for delimiter $FF40 ONSCIOInitialize I/O device $FF43 INPUT Read I/O device $FF46 OUTPUT Write I/O device $FF49 OUTLHLF Convert left nibble to ASCII and output $FF4C OUTRHLF Convert right nibble to ASCII and output $FF4F OUTA Output ASCII character $FF52 OUTlBYT Convert binary byte to 2 ASCII characters and output $FF55 OUT1BSP Convert binary byte to 2 ASCII characters and output followed by space $FF58OUT2BSP Convert 2 consecutive binary bytes to 4 ASCII characters and output followed by space. $FF5B OUTCRLF Output ASCII carriage return followed by line feed $FF5E OUTSTRG Output ASCII string until end of transmission ($04) $FF61 OUTSTRGO Same as OUTSTRG except leading carriage return and line feed is skipped $FF64INCHARInput ASCII character and echo back To use an I/O subroutine, Jump Sub Routine (JSR) to the specified address listed below. ADDRESS SUBROUTINE FUNCTION

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Utility Subroutines Examples Example: OUTA ORG $1000 LDAA #$41*Load acc. A with ASCII code for the *character A. JSR $FF4F*JSR to the subroutine OUTA SWI END Result  A is written to the screen.

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Utility Subroutines Examples Example: OUTSTRG (Output ASCII Character String until EOT, $04, is encountered) STR1 EQU $2100 OUTSTRGEQU $FF5E ORG STR1 FCC “ABCDEFG” FCB #$04 ORG $1000 LDX #STR1 JSR OUTSTRG*Go to OUTSTRG routine which *outputs ASCII characters contained in each *address starting from $2100 until *an EOT character is found. SWI END Result  ABCDEFG written to the screen on a new line. (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)

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 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.)

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Example: OUTLHLF (Out Left Half) and OUTRHLF (Out Right Half) ORG $1000 LDAA #$AF *Puts hex number $AF in acc. A JSR $FF49 *Goes to subroutine OUTLHLF which converts left *nibble, #$A, to ASCII number, $41, and then outputs *its ASCII character, ‘A, to the screen. LDAA #$AF *Reload Acc. A since OUTLHLF modifies the contents of *Acc. A JSR $FF4C *Goes to subroutine OUTRHLF which converts right *nibble, #$F, to ASCII number, $46, and then outputs *its ASCII character, ‘F, to the screen. SWI END Result  AF is written to the screen. Utility Subroutines Examples

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 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 $1000 LDX #$2100 JSR $FF52 *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. JSR $FF55 *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. SWI END Result  FAFB_ sent to screen (Note: last character is a space) Utility Subroutines Examples

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Example: OUT2BSP (Out 2 Bytes with Space) Assume that memory contains the following: 2100 FA FB Now execute the following code. ORG $1000 LDX #$2100 JSR $FF58 *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. SWI END Result  FAFB_ sent to screen (last character is a space). Utility Subroutines Examples

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Example: OUTCRLF (Output Carriage Return with Line Feed) ORG $1000 JSR $FF5B *Go to subroutine OUTCRLF *which outputs ASCII carriage return *followed by a line feed. SWI END Result  New line on screen (Note:Equivalent to pressing Enter in your computer) Utility Subroutines Examples

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Example: INCHAR (Input Character) ORG $1000 JSR $FF64 *Goes to subroutine INCHAR. Waits for you to *type an ASCII character from the keyboard, *and stores the corresponding ASCII number in *accumulator A SWI END Result-> If you type 9 on the keyboard, ASCII number $39 is stored in accumulator A Utility Subroutines Examples

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Example 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 FCC is used to store a string of characters FCB is used to store End Of Transmission (EOT) (Note 1: EOT in ASCII is $04) (Note 2: In this particular example any non-printing character can be used) OUTAEQU$FF4F ORG $2000 FCC “HELLO” FCB #$04 ORG $1000 LDX #$2000 LoopLDAA$00,X CMPA #$04 BEQ Quit JSR OUTA INX BRA Loop QuitSWI END

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 #$2000 #$2001#$2002#$2005 #$04 1 OUTAEQU$FF4F ORG $2000 FCC “Hello” FCB #$04 ORG $1000 LDX #$2000 LoopLDAA$00,X CMPA #$04 BEQ Quit JSR OUTA INX BRA Loop QuitSWI END $2000 $2001 $2002 $2003 $2004 $2005 CPU Registers Used in Program: Memory Locations Used in Program: Computer Screen: Program Initialization $48 $65 $6C $6F $04 Accum A: Index X: CCR Bit Z: #$48 0 CCR Z is 0 since Accum A does not equal $04 Does not branch because CCR Z is 0 H Always Branches #$65 e Skip Ahead Until Last Loop llo CCR Z is 1 since Accum A equals $04 Branch since CCR Z is 1 #$6F Ascii Equivalent of “Hello”

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 Solution 2: This particular solution will print “Hello” to the screen using the OUTSTRG subroutine OUTSTRGEQU$FF5E ORG$2000 FCC“HELLO” FCB#$04 ORG$1000 LDX#$2000 JSROUTSTRG SWI END OUTSTRG: Output ASCII string until end of transmission ($04) (Note: EOT must be used because the OUTSTRG Subroutine uses EOT as the end of the string)

George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 QUESTIONS???