NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

Similar documents
MICROPROCESSOR AND MICROCOMPUTER BASICS

MACHINE ARCHITECTURE & LANGUAGE

Microprocessor & Assembly Language

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Decimal to Binary Conversion

The Hexadecimal Number System and Memory Addressing

Z80 Instruction Set. Z80 Assembly Language

PART B QUESTIONS AND ANSWERS UNIT I

8051 MICROCONTROLLER COURSE

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

Decimal Number (base 10) Binary Number (base 2)

Programming Logic controllers

Parallax Serial LCD 2 rows x 16 characters Non-backlit (#27976) 2 rows x 16 characters Backlit (#27977) 4 rows x 20 characters Backlit (#27979)

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window)

Interfacing Analog to Digital Data Converters

Binary Numbers. Binary Octal Hexadecimal

Notes on Assembly Language

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

CPU Organisation and Operation

Appendix C: Keyboard Scan Codes

Table 1 below is a complete list of MPTH commands with descriptions. Table 1 : MPTH Commands. Command Name Code Setting Value Description

2011, The McGraw-Hill Companies, Inc. Chapter 3

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

SYMETRIX SOLUTIONS: TECH TIP August 2015

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

Microtronics technologies Mobile:

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

TIMING DIAGRAM O 8085

Lab 1: Full Adder 0.0

Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

PACKAGE OUTLINE DALLAS DS2434 DS2434 GND. PR 35 PACKAGE See Mech. Drawings Section

Intel Hexadecimal Object File Format Specification Revision A, 1/6/88

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

(Refer Slide Time: 00:01:16 min)

Interfacing To Alphanumeric Displays

=

HD44780U (LCD-II) (Dot Matrix Liquid Crystal Display Controller/Driver)

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

Lecture N -1- PHYS Microcontrollers

The use of binary codes to represent characters

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

Hexadecimal Object File Format Specification

Numbering Systems. InThisAppendix...

LMB162ABC LCD Module User Manual

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

İSTANBUL AYDIN UNIVERSITY

LADDER LOGIC/ FLOWCHART PROGRAMMING DIFFERENCES AND EXAMPLES

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

Numeration systems. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

Programming Flash Microcontrollers through the Controller Area Network (CAN) Interface

Z80 Microprocessors Z80 CPU. User Manual UM Copyright 2014 Zilog, Inc. All rights reserved.

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

ND48-RS ASCII A2.04 Communication Protocol

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

An Introduction to MPLAB Integrated Development Environment

STUDY GUIDE CHAPTER 1

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

Base Conversion written by Cathy Saxton

CSE 141L Computer Architecture Lab Fall Lecture 2

MTS Master Custom Communications Protocol APPLICATION NOTES

1 Classical Universal Computer 3

ELEC EXPERIMENT 1 Basic Digital Logic Circuits

SMC 3000 Series Master Clock Programming Manual (V3) Table of Contents. Getting Started.. Page 2. Setting the Time of Day...

Lab 17: Building a 4-Digit 7-Segment LED Decoder

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Section 1.4 Place Value Systems of Numeration in Other Bases

Computer Science 281 Binary and Hexadecimal Review

================================================================

Figure 1: Graphical example of a mergesort 1.

DS1621 Digital Thermometer and Thermostat

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

Memory Systems. Static Random Access Memory (SRAM) Cell

Conversion Between Analog and Digital Signals

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

CONCEPT1 RS232 COMMUNICATION

IBM Emulation Mode Printer Commands

Programmer s Reference

UMBC. ISA is the oldest of all these and today s computers still have a ISA bus interface. in form of an ISA slot (connection) on the main board.

CHAPTER 4 MARIE: An Introduction to a Simple Computer

TEST CHAPTERS 1 & 2 OPERATING SYSTEMS

CHAPTER 11: Flip Flops

Objectives: Part 1: Build a simple power supply. CS99S Laboratory 1

Counting in base 10, 2 and 16

earlier in the semester: The Full adder above adds two bits and the output is at the end. So if we do this eight times, we would have an 8-bit adder.

Chapter 3: Computer Hardware Components: CPU, Memory, and I/O

Visa Smart Debit/Credit Certificate Authority Public Keys

Part Number Description Packages available

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

8051 hardware summary

Chapter 5 Instructor's Manual

RDF1. RF Receiver Decoder. Features. Applications. Description. Ordering Information. Part Number Description Packages available

Chapter 1. The largest computers, used mainly for research, are called a. microcomputers. b. maxicomputers. c. supercomputers. d. mainframe computers.

Transcription:

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE ECE 270 Experiment #9 MICROPROCESSORS PRELAB 1. Fill in the Hex Code and Comment in the table for Experiment C. 2. Fill in the Hex Code and Comment in the table for Experiment D. 3. Do number 15 under Experiment G.

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE ECE 270 Experiment #9 MICROPROCESSORS Reference: Smith, R.J., Electronics, Circuits and Devices, Wiley, 1980. Chapters 9. In the past experiments, we examined various digital devices and understood how these basic elements are used to develop larger and more elaborate digital systems. One of these digital systems is known as the microprocessor. A microprocessor is a single integrated circuit (or sometimes just called a chip) that possesses at least 75% of the computing and data manipulation power of a digital computer. It usually cannot function without the aid of support chips and memory. A microcomputer is a fully operational digital computer that is based on a microprocessor chip. A computer program can be defined as a series of instructions written n a form acceptable to the computer, the purpose of which is to achieve a certain result. With microcomputers, we are more interested in writing microcomputer programs that control the operation of a device or machine. For example, in a home clothes washer, you may want to control the amount of water used, or the duration of the various washing cycles. All of this can be done with a correctly written and organized computer program. All instructions used in computer programs are made up of a set of characters that define an operation. Computer instructions may be expressed in a variety of forms. They can be expressed as binary numbers (11010011, 00111110), hex numbers (D3H, 3EH), mnemonic code (OUT 3EH; LD A, 02H), etc. Our common numbering system is a base 10 system. We can count from 0 to 9 and then we have to add a second digit, etc. This counting system is then said to have a bass or radix of 10. A binary numbering system has a base of 2 and a hexadecimal numbering system has a base of 16. A large number represented in the binary numbering system would have many digits and could be difficult to remember. One way to remember 8-bit binary numbers is to use hexadecimal code (we are using 8-bit numbers here because we will use them when we program our microprocessor). It is possible to convert binary numbers into hex numbers so they are easier to remember. Note that when a number has a capital H after it, it refers to a number in the hexadecimal system. For example, 3EH refers to a hex number of 3E and can be converted to a binary number using the table below. In our example, 3EH can be converted into the binary code 00111110. It is a standard contention to put a space between each 4-bit group of binary numbers, so it is easier to read. (0011 1110). Each 8-bit number is converted into a 2 digit hex code.

Decimal Number Binary Number Hex Number 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F THE Z80 MICROPROCESSOR The basic function of a microprocessor is to perform arithmetic, logic, and control operations on data obtained from input devices, perform some operation on the data based on instructions the programmer has placed into the microprocessor, and provide the results of that operation to various output devices, such as a video display terminal. The microprocessor that we are going to use is the Zilog Z80. This microprocessor was introduced in 1976 and is still one of the most popular devices on the market. It is contained in a 40-pin DIP (Dual In-Line Package) and uses a set of 158 instructions. For more information about microcomputers technology and the Z80, refer to Chapter 9 of Electronics. The Z80 uses instructions that are entered into the microprocessor using hex code, with mnemonic codes to assist the programmer in formulating his program. For most of the experiments, the instructions will be provided. The complete instruction set can be obtained in the lab. OPERATION OF THE MICROPROFESSOR The Micro-Professor contains a QWERTY keyboard, which is used to input program instructions and control the operation of the microprocessor trainer. See pp. 30-47 in the user's manual accompanying the trainer for a description of the commands you'll be using in the experiments.

PROCEDURE In this experiment, our goal is to become familiar with the keyboard controls and display elements of the Micro- Professor. Make sure to read carefully the explanations of the various commands BEFORE you start the experiment. As an introduction, perform the following example. LOAD the A (accumulator) register with 27H. Load the B register with 03H. ADD the contents of the B register to the A register and store the result in A. Halt the Z80. To find the instructions necessary to implement this program, we look into the Z80 instruction set and find: LD A,n 3E n Load register A with a 2 digit hex number n LD B,n 06 n Load register B with a 2 digit hex number n ADD A,B 80 Add B to A and store the result in A BREAK F7 Break the execution To load this into the trainer, press RS to reset the system. The display should read **MPF-I-PLUS**. The first program line must start at the memory location F000H. To get to this location, type in M. The display should then show <M>. Now enter the memory address F000. If you then press the carriage return, you will see displayed the present contents of memory location F000 to F003 (try it). We wish instead to enter numbers into memory, which can be done by typing a colon after the memory address. To try this, type in MF000: You can now begin entering the hex code for the program, separating each two digit hex number with a space. After entering the final instruction (BREAK), press the carriage return. Up to 48 numbers or spaces can be entered at a time. Now that all instructions have been entered, they can be checked by entering MF000 (carriage return). The first four bytes of instructions are shown in the display. To see the next four bytes, press the down arrow key. When the breakpoint is encountered, program execution stops, and the display show the address of the next instruction (for this example, F006), and the contents of register pairs AF and BC. The contents of the other registers can be observed by pressing the down arrow key. Since this program added two hex numbers and deposited the sum in A, the first two hex digits in the AF register pair display should be the sum of these two numbers. To run the program, press GF000 (carriage return). "G" means run, and F000 is the program's starting address in memory. The program is halted by the breakpoint, and the contents of register pairs AF and BC is displayed. 1. What is the hex number that is in register A? 2. Does the number in register A correspond to the sum of 27H and 03H? 3. What would be the procedure to ADD 2FH and 45H? Execute the program with these numbers. What do you get for the answer? Is it correct?

PROGRAMMING EXPERIMENTS: The following experiments will provide you with an opportunity to understand the basics of programming. For some of the experiments, the instructions will be provided. However, you should look up these instruction in the instruction set provided to make sure that they are correct. Experiment A: LOAD A with 48H, LOAD C with FFH, ADD A and C and store the result in B, then BREAK. 4. What are the contents of registers A, B and C after running this program? Experiment B: LD A,11H 3E 11 Load register A with 11H LD (F007H),A 32 07 F0 Load memory location Foo7 with contents of A BREAK F7 Enter the above program into the trainer and run it. Notice that we are using a new notation for loading a number from a register to memory location. Also notice that the location number is entered with the last two digits of the address (07) coming first. This is a feature of the Z80 instruction set. In general, the instruction is LD (nn),a, where nn is a 4-digit hex number indicating the address to which data is to be deposited. Experiment C: Manually load this data: 27H at address F00D, and 03H at F00E. Translate and enter the following program: LD A,(F00D) LD B,A LD A,(F00E) ADD A,B LD(F00F),A BREAK 5. What does this program do? 6. What is in memory location F00F?

Experiment D: Translate and enter the following program: LD B,08H INC B LD C,B INC C LD D,C INC D LD E,D DEC E LD H,E DEC H LD L,H DEC L LD A,L BREAK Verify that this program was loaded correctly. 7. Analyze the program and predict the value which will be in each register at the end of the program. 8. After running the program, what are the values in register A, B, C, D, E, H, and L? 9. Now change the data byte at location F001H to 01H and repeat 7 and 8.

Experiment E: Load the following program at F000H. LD A,FFH 3E FF Load A with FFH INC A 3C Increment A JP F002H C3 02 F0 Jump to F002H 10. Execute the program at full speed. What happened? 11. Execute the program in the single step mode (S command) and write down the contents of Register A after going through the program ten times. 12. What does the program do? Experiment F: 13. Come up with a program of your own (one for each lab group - not a program that is listed above) and use the trainer to execute it. First, draw a flow chart of what you want to do. Then, write the mnemonics to realize it, and then translate the mnemonic code into hex code and enter it. 14. After you get your program to work, show it to the T.A., explaining what it does and verifying its operation.

Experiment G: Transferring data to and from memory and the CPU is not the only way to communicate with a microprocessor. Communication with the "outside world" is done with I/O or input and output instruction. Input and output ports are used to implement these instructions. A port is essentially an 8-bit latch similar to an internal register except that it is accessible in some way from outside the microprocessor. For example the instruction: OUT 02,A sends the 8 bits of data from the accumulator to output port 02. I/O ports are addressed similarly to memory locations in RAM or ROM, except 8 bit addresses are used (rather than 16). Some typical uses for I/O ports are for keyboards (input), LED and CRT displays (output), and for many other types of microprocessor-based control systems. The MPF-I+ has some I/O ports already defined on it. For example: Port 80 7 segment display digits 1-8 Port 81 7 segment display digits 9-16 Port 92 LED and speaker (bit 5) Information on other ports can be found in the user manual on pages 113-114. In this experiment, you will generate a sound on the speaker and/or blink the LED. The LED will be "on" when a 0 is sent to port 92, bit 5. To generate a tone on the speaker, a square wave must be sent to it. This means sending a succession of 0's and 1's to the correct port. 15. Write a program to generate a tone to the speaker. 16. Does the LED blink? Why or why not? 17. Determine the frequency of the tone emitted by the speaker. 18. How could you raise or lower this tone? 19. Change the frequency (and, therefore, the pitch) of the tone. Note: To achieve an audible tone, you may have to implement "delays" in your program. These are simply program loops which have no purpose but to use up some of the microprocessor's instruction cycle time. For example: LOOP: LD D,FFH DEC D JNZ LOOP