CREATING LOOP-BASED TIME DELAYS IN MICROPROCESSOR SYSTEMS

Size: px
Start display at page:

Download "CREATING LOOP-BASED TIME DELAYS IN MICROPROCESSOR SYSTEMS"

Transcription

1 CREATING LOOP-BASED TIME DELAYS IN MICROPROCESSOR SYSTEMS Assoc. Prof. Dr. Dogan Ibrahim Department Of Computer Engineering, Near East University, Mersin 10, Turkey ABSTRACT Time delays are an important part of programming. A microprocessor operates very fast and it only takes a few microseconds or less to execute an instruction. There are many applications where it is required to slow down the processor so that an output can be observed. For example, flashing an LED on and off every second. This paper describes the methods that can be employed to introduce loop-based time delays into microprocessors. The Z80 microprocessor is taken as an example processor in the paper, but the techniques developed are easily applicable to other microprocessors. 1. INTRODUCTION There are many cases in microprocessor and microcontroller based designs where it is required to create time delays in order to slow down the execution time. For example, flashing an LED on and off every second, performing some operations at specified time intervals and so on. In microprocessors time delays can either be introduced by using external hardware (e.g. timer and counter chips), or program loops can be created to keep the microprocessor busy inside the loop. By adjusting the size of the loop it is possible to create various delay loops, ranging from milliseconds to seconds and even more. This paper describes how accurate time delays can be generated using program loops in microprocessors. The Z80 microprocessor is taken as an example processor in the paper, but the techniques described are general and should easily be applicable to other types of microprocessors. 2. CREATING TIME DELAYS WITH SIMPLE LOOPS The simplest form of creating time delay in a program is to keep the microprocessor busy in a loop for the required amount of time. This is usually achieved by loading a general purpose register with the appropriate count and then setting up a loop to decrement the count until it reaches to zero. The delay is then determined by the time it takes for the microprocessor to execute this loop. Therefore, the delay depends on the clock frequency of the microprocess the number of instructions inside the loop, and the number of times the loop is repeated. The higher the clock frequency, the less will be the delay. Similarly, the higher the number of times a loop is repeated, the more will be the delay. Figure 1 shows a flowchart of how time delay can be created using a simple program loop. The following Z80 microprocessor program code shows how time delay can be created using a simple program loop: LD LOOP: DEC JP B,0AH B NZ,LOOP In the above code, the loop is repeated 10 times. In order to calculate the amount of delay generated by this code, we have to know the time it takes to execute each instruction. For the case of the Z80 microprocessor this is given by the instruction T-states. One T-state is equivalent to one clock period of the microprocessor clock. For example, if a 2MHz clock is used, one clock period is equivalent to 0.5µs. Similarly, for a 4MHz clock, one clock period is 0.25µs. 23

2 If N tout is the total number of T-states outside the loop, and T c is the clock period of the microprocess then T out is given by: Load count in register T out = T c x N tout (2) Similarly, if N is the loop count and N tloop is the total T-states inside the loop, the total delay inside the loop can be calculated as: no Decrement count Count = 0? yes T loop = T c x N tloop x N (3) The total delay can then be calculated by using equations (1), (2), and (3) as: T D = T c x N tout + T c x N tloop x N (4) T D = T c (N tout + N tloop x N) (5) Equation (5) can be used to calculate the total delay created by a single delay loop. An example is given below to illustrate how equation (5) can be used. Fig. 1. Creating time delay using a simple loop The T-states of the instructions are given in the Z80 instruction set. The T-states of the above code are: LD B,0AH 7 LOOP: DEC B 4 JP NZ,LOOP 10 The LD B,0AH instruction is executed in 7 T- states. Using a 2 MHz clock frequency, this instruction will take 3.5µs. If the clock frequency is 4MHz, the same instruction will only take 1.750µs. As can be seen from the above code, the delay program is in two parts: the fixed delay outside the loop,a nd the delay inside the loop. The total delay is the sum of these two components and can be expressed as: Example 1 Calculate the total delay in the following program code. Assume a clock frequency of 2MHz. Solution 1 LD B, 100 LOOP: DEC B JP NZ, LOOP The clock period is, 1/f = 0.5µs. The T-states are: LD B, LOOP: DEC B 4 JP NZ, LOOP 10 In equation (5), where, T D = T out + T loop (1) T D is the total delay T out is the delay outside the loop T loop is the delay inside the loop T c = 0.5µs N tout = 7 N tloop = 14 N = 100 The delay is then calculated as: T D = T c (N tout + N tloop x N) 24

3 = 0.5( x 100) T D = 703.5µs In many applications, the delay outside the loop is very small compared to the loop delay and it can be ignored. 3. CALCULATING THE LOOP COUNT FOR A REQUIRED TIME DELAY In practical applications we need to know the value of the loop count (N) to use so that a required delay can be generated by a delay loop. The value of N can be calculated from equation (5) as: N = [T D /T c - N tout ] / N tloop (6) An example is given below which illustrates how the loop count can be calculated to give a required delay. Example 2 It is required to generate a 400µs delay using a simple loop. Assuming the clock frequency is 2MHz, what will be the value of the loop count? Solution 2 The delay loop is given below: LD B, N 7 LOOP: DEC B 4 JP NZ, LOOP 10 Where it is required to calculate N. With a clock frequency of 2MHz, the period is, 1/f = 0.5µs. From equation (6): 4. TIME DELAY SUBROUTINE Delays are usually created as subroutines in separate parts of a program and they are called from the main program. Delay subroutines are developed so that they do not change any registers of the main program. This is usually achieved by saving the registers used on the stack (with PUSH instructions) at the beginning of the delay subroutines. These registers are restored (with POP instructions) at the end of the delay subroutine. An example subroutine based delay loop is given below. Main Program CALL DELAY Delay Subroutine DELAY: PUSH BC LD B, N LOOP: DEC B JP NZ, LOOP POP BC RET Using equation (5), the total delay can be calculated as: T D = T c (N tout + N tloop x N) The CALL instruction is executed in 17 T- states, the RET instruction is executed in 10 T- states, the PUSH and POP instructions are executed in 11 and 10 T states respectively. Thus, N tout = = 55 N tloop = 14 N = [T D /T c - N tout ] / N tloop = [400/0.5 7] / 14 N = 56.6 The total delay is then related to the loop count N as shown by equation (7): T D = T c ( N) (7) Since N is an integer, we can use N = 56. With a 2MHz clock the maximum delay is: 25

4 T D = 0.5( x 255) T D = µs and with a 4MHz clock the maximum delay is: T D = 0.250( x 255) T D = µs Figure 2 shows the change of delay as the loop count N is varied, for both 2MHz and 4MHz clock frequencies. microseconds Loop count, N 2MHz 4MHz Fig. 2 Change of delay with loop count, N 5. CREATING LARGER TIME DELAYS The maximum delay that can be generated with a simple loop and a register is in the region of a few milliseconds. There are some applications where much larger delays are required. This section gives two methods which can be used to create higher delays in programs. 5.1 Using A Register Pair The maximum value a register can hold is 255. As a result of this the maximum delay is limited to a few milliseconds as shown in previous section. It is possible to create higher delays by using a register pair. The maximum value a register pair can hold is The following delay subroutine shows how register pair BC can be used to create higher delay values. Note that when BC is decremented the flags do not change and as a result of this it is not possible to use a conditional jump instruction following a DEC BC instruction. The accumulator is set to zero at the beginning of the subroutine and B and C are compared with the accumulator. When both B and C are zero, the subroutine returns to the main program. Main Program CALL DELAY Delay Subroutine DELAY: PUSH BC PUSH AF LD BC, NN LD A,0 MORE:DEC BC CP B JP NZ, MORE CP C JP NZ, MORE POP AF POP BC RET The T-states of the instructions are written against each instruction as shown below: Main Program CALL DELAY 17 Delay Subroutine DELAY: PUSH BC 11 PUSH AF 11 LD BC, NN 10 LD A,0 7 MORE: DEC BC 6 CP B 4 JP NZ, MORE 10 CP C 4 26

5 JP NZ, MORE 10 POP AF 10 POP BC 10 RET 10 Using equation (5), the total delay can be calculated as: where, 10 = 86 Thus, T D = T c (N tout + N tloop x NN) N tout = N tloop = 34 and NN varies between 0 and T D = T c ( NN) (8) The maximum delay that can be generated with a 2MHz clock frequency is: T D = 0.5( x 65535) T D = seconds and the maximum delay that can be generated with a 4MHz clock frequency is: T D = 0.250( x 65535) T D = seconds Figure 3 shows the change of the delay with the loop count, NN for both 2MHz and 4MHz clock frequency. Example 3 It is required to generate an approximately one second delay loop in a program. Assuming that the clock frequency is 2MHz, what will be the approximate value of the loop count (NN) if the delay is to be generated using a subroutine as described in section 5.1. Use Figure 3 to find the value of NN. Solution 3 Using Figure 3, the required value of the loop count is approximately, NN = (i.e. the hexadecimal value EA60 should be loaded into register pair BC). milliseconds Loop count, NN Fig. 3 Variation of delay with loop count NN when a register pair is used 5.2 Using Multiple Delay Loops It is also possible to use nested loops to increase the delay time. This technique is usually used when large delays are required. In nested loop technique two loops are used and different registers are decremented in each loop. The following code shows how nested delay loops can be used with registers: LD C, N 1 LOOP1: LD B, N 2 LOOP2: DEC B JP NZ, LOOP2 DEC C JP NZ, LOOP1 When this code is used as a delay subroutine we have to save the registers modified by the code at the beginning. Also, the registers should be restored at the end of the subroutine. The following example code shows how a nested loop delay subroutine can be created. The T-states of each instruction are listed next to the instructions: DELAY:PUSH BC 11 LD C, N 1 7 LOOP1: LD B, N 2 7 2MHz 4MHz 27

6 LOOP2: DEC B 4 JP NZ, LOOP2 10 DEC C 4 JP NZ, LOOP1 10 POP BC 10 RET 10 The total delay can be calculated as follows: The delay in the inner loop (LOOP2) is given by: x N 2 The outer loop is repeated N 1 times and this loop includes the inner loop and in addition the instructions DEC C and JP NZ, LOOP1 which add 14 T-states every iteration. The total delay generated by the outer and the inner loops is therefore: N 1 ( x N ) The delays caused by the instructions outside the outer loop are: = 38 T-states programs described are for the Z80 microprocessor but the techniques discussed should easily be applicable to other types of microprocessors. REFERENCES [1] D. Ibrahim Dynamically Programmable Monostable/astable, Electronic Product Design, Design Ideas, January [2] R. Zaks Programming the Z80, Sybex publications, [3] R. Zaks and A. Lesea Microprocessor Interfacing Techniques, Sybex publications. [4] S.E. Derenzo Interfacing: A Laboratory approach using the microcomputer for instrumentation, data analysis and, control, Prentice-Hall Inc., Adding to this the delay caused by calling the subroutine (CALL DELAY instruction), the total fixed delays are = 55 T-states. The overall delay is then given by: T D = T c x [N 1 ( x N ) + 55] T D = T c x [N 1 (14N ) + 55] (9) Using equation (9), the maximum delay with a 2MHz clock frequency is: T D = 0.5 x [255(14 x )+55] T D = 457.8ms with a 4MHz clock frequency the maximum delay is 229ms. To achieve even higher delays, one can use register pairs in nested loops. 6. CONCLUSIONS This paper has described how loop-based time delays can be generated in microprocessor based systems using simple program loops. The 28

E3940 Microprocessor Systems Laboratory. Introduction to the Z80

E3940 Microprocessor Systems Laboratory. Introduction to the Z80 E3940 Microprocessor Systems Laboratory Introduction to the Z80 Andrew T. Campbell comet.columbia.edu/~campbell campbell@comet.columbia.edu E3940 Microprocessor Systems Laboratory Page 1 Z80 Laboratory

More information

Counters & Time Delays. Microprocessors & Interfacing 1

Counters & Time Delays. Microprocessors & Interfacing 1 Counters & Time Delays Microprocessors & Interfacing 1 Counters A loop counter is set up by loading a register with a certain value Then using the DCR (to decrement) and INR (to increment) the contents

More information

BHARATHIDASAN ENGINEERING COLLEGE. III Year / V Semester / EEE MICROPROCESSORS AND MICROCONTROLLERS (R-2013)

BHARATHIDASAN ENGINEERING COLLEGE. III Year / V Semester / EEE MICROPROCESSORS AND MICROCONTROLLERS (R-2013) BHARATHIDASAN ENGINEERING COLLEGE III Year / V Semester / EEE MICROPROCESSORS AND MICROCONTROLLERS (R-2013) FREQUENTLY ASKED QUESTIONS IN UNIVERSITY EXAMINATION PART A UNIT 1-8085 PROCESSOR 1. Draw the

More information

8051 Overview and Instruction Set

8051 Overview and Instruction Set 8051 Overview and Instruction Set Curtis A. Nelson Engr 355 1 Microprocessors vs. Microcontrollers Microprocessors are single-chip CPUs used in microcomputers Microcontrollers and microprocessors are different

More information

Microcomputer Architecture and Programming

Microcomputer Architecture and Programming IUST-EE (Chapter 1) Microcomputer Architecture and Programming 1 Outline Basic Blocks of Microcomputer Typical Microcomputer Architecture The Single-Chip Microprocessor Microprocessor vs. Microcontroller

More information

8051 Microcontroller Interrupts

8051 Microcontroller Interrupts 8051 Microcontroller Interrupts There are five interrupt sources for the 8051, which means that they can recognize 5 different events that can interrupt regular program execution. Each interrupt can be

More information

Write A General Form Of The Assembly

Write A General Form Of The Assembly Write A General Form Of The Assembly Instruction Of 8085 Official Full-Text Publication: An Introduction to Microprocessor 8085 on ResearchGate, the professional network for scientists. Therefore, it is

More information

ELEG3924 Microprocessor

ELEG3924 Microprocessor Department of Electrical Engineering University of Arkansas ELEG3924 Microprocessor Ch.3 Jump, Loop, and Call Dr. Jing Yang jingyang@uark.edu 1 OUTLINE Loop and Jump instructions Call instructions Time

More information

Rotate Instructions in 8085 Microprocessor to Support Traffic control Signal Processes through Assembly Language which to be Taken as Input of 05H

Rotate Instructions in 8085 Microprocessor to Support Traffic control Signal Processes through Assembly Language which to be Taken as Input of 05H Rotate Instructions in 8085 Microprocessor to Support Traffic control Signal Processes through Assembly Language which to be Taken as Input of 05H P.Hariharan 1, Assistant Professor Department of Computer

More information

ELEG3923 Microprocessor Ch.3 Jump, Loop, and Call

ELEG3923 Microprocessor Ch.3 Jump, Loop, and Call Department of Electrical Engineering University of Arkansas ELEG3923 Microprocessor Ch.3 Jump, Loop, and Call Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Loop and Jump instructions Call instructions Time delay

More information

COMPUTER ARCHITECTURE AND PARALEL PROCESSING STUDY NOTES

COMPUTER ARCHITECTURE AND PARALEL PROCESSING STUDY NOTES COMPUTER ARCHITECTURE AND PARALEL PROCESSING STUDY NOTES UNIT 1 INTRODUCTION Central Processing unit (CPU): Alternately referred to as a processor, central processor, or microprocessor, the CPU is the

More information

Assembly Language programming (3)

Assembly Language programming (3) EEE3410 Microcontroller Applications LABORATORY Experiment 3 Assembly Language programming (3) Name Class Date Class No. Marks Conditional Program Branching and Subroutine Call in 8051 Objectives To learn

More information

Q. P. Code : b. Draw and explain the block dig of a computer with microprocessor as CPU.

Q. P. Code : b. Draw and explain the block dig of a computer with microprocessor as CPU. Q. P. Code : 08235 (2½ Hours) [Total Marks: 75] N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question

More information

INSTITUTE OF ENGINEERING AND MANAGEMENT, KOLKATA Microprocessor

INSTITUTE OF ENGINEERING AND MANAGEMENT, KOLKATA Microprocessor INSTITUTE OF ENGINEERING AND MANAGEMENT, KOLKATA Microprocessor Subject Name: Microprocessor and Microcontroller Year: 3 rd Year Subject Code: CS502 Semester: 5 th Module Day Assignment 1 Microprocessor

More information

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss

Grundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss Grundlagen Microcontroller Processor Core Günther Gridling Bettina Weiss 1 Processor Core Architecture Instruction Set Lecture Overview 2 Processor Core Architecture Computes things > ALU (Arithmetic Logic

More information

ET2640 Microprocessors

ET2640 Microprocessors ET2640 Microprocessors Unit -2 Processor Programming Concepts Basic Control Instructor : Stan Kong Email : skong@itt-tech.edu Figure 2 4 Bits of the PSW Register 8051 REGISTER BANKS AND STACK 80 BYTES

More information

Chapter Introduction Chapter 1. a) Address translation b) Protection c) Program relocation. type's "««"** ***** ** various

Chapter Introduction Chapter 1. a) Address translation b) Protection c) Program relocation. type's ««** ***** ** various 72 Introduction Chapter 1 a) Address translation b) Protection c) Program relocation Chapter 2 type's "««"** ***** ** various 1.17 Discuss the main features' of typical coprocessors. o ' rhc diffcrcncc

More information

Introduction to Microcontrollers III

Introduction to Microcontrollers III Introduction to Microcontrollers III Timing Functions Delay5u.a11, Delay1m.a11 µp Laboratory #3 Data Entry : µp Laboratory #2 Hints Use the pushbutton routine from count.a11 or count_br.a11 (WAIT0 and

More information

Chapter 3 BRANCH, CALL, AND TIME DELAY LOOP

Chapter 3 BRANCH, CALL, AND TIME DELAY LOOP Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 3022: Embedded Systems Discussion Chapter 3 BRANCH, CALL, AND TIME DELAY LOOP Eng. Eman R. Habib February, 2014 2 Embedded

More information

2003 LXI H, 42F2H ; this instruction store 42F2 in to the HL pair POP H ; store data from top of the stack to HL pair

2003 LXI H, 42F2H ; this instruction store 42F2 in to the HL pair POP H ; store data from top of the stack to HL pair (1) What is stack? Explain stack related instruction with example OR Give function of stack. OR What is stack? Explain the stack operations using examples. The stack is a group of memory location in the

More information

Subroutines & Software Delay Routines

Subroutines & Software Delay Routines Subroutines & Software Delay Routines Department of EIE / Pondicherry Engineering College 1 Subroutines & Software Delay Routines This chapter introduces software based timing routines. The examples introduce

More information

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text 1. Interrupt An interrupt is the occurrence of a condition--an event --

More information

Interrupt and Timer ISRs. Student's name & ID: Partner's name(s) & ID(s): Your Section number & TA's name

Interrupt and Timer ISRs. Student's name & ID: Partner's name(s) & ID(s): Your Section number & TA's name MPS Interrupt Lab Exercise Interrupt and Timer ISRs Student's name & ID: Partner's name(s) & ID(s): Your Section number & TA's name Notes: You must work on this assignment with your partner. Hand in a

More information

Introduction to Microcontrollers III

Introduction to Microcontrollers III Introduction to Microcontrollers III Timing Functions Delay5u.a11, Delay1m.a11 µp Laboratory #3 Data Entry : µp Laboratory #2 Hints Use the pushbutton routine from count.a11 or count_br.a11 (WAIT0 and

More information

CHAPTER 3 JUMP, LOOP, AND CALL INSTRUCTIONS

CHAPTER 3 JUMP, LOOP, AND CALL INSTRUCTIONS CHAPTER 3 JUMP, LOOP, AND CALL INSTRUCTIONS Looping Repeating a sequence of instructions a certain number of times is called a loop Loop action is performed by DJNZ reg, Label The register is decremented

More information

EECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution

EECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution 1. (40 points) Write the following subroutine in x86 assembly: Recall that: int f(int v1, int v2, int v3) { int x = v1 + v2; urn (x + v3) * (x v3); Subroutine arguments are passed on the stack, and can

More information

Introduction to general architectures of 8 and 16 bit micro-processor and micro-controllers

Introduction to general architectures of 8 and 16 bit micro-processor and micro-controllers Introduction to general architectures of 8 and 16 bit micro-processor and micro-controllers A microcontroller is a microprocessor with inbuilt peripherals.a microcontroller can also be compared with a

More information

ORG ; TWO. Assembly Language Programming

ORG ; TWO. Assembly Language Programming Dec 2 Hex 2 Bin 00000010 ORG ; TWO Assembly Language Programming OBJECTIVES this chapter enables the student to: Explain the difference between Assembly language instructions and pseudo-instructions. Identify

More information

Fig7 give the ALP for this problem THIS PROGRAMME / SUM OF N NATURAL NUMBERS FOR N G.T 22 ORG LNN EQU 360 D NSUM: LXIH, 0000 H ; INITIALIZE.

Fig7 give the ALP for this problem THIS PROGRAMME / SUM OF N NATURAL NUMBERS FOR N G.T 22 ORG LNN EQU 360 D NSUM: LXIH, 0000 H ; INITIALIZE. Lecture-31 Example: Write the software program for the same problem is example if the largest natural number exceeds 22. In this case the sum shall exceed 8 bite therefore 16 bit operation are involved

More information

A 3-SPEED STEPPER MOTOR

A 3-SPEED STEPPER MOTOR ECE 36 Projects; Stepper Motor 1 of 5 A 3-SPEED STEPPER MOTOR 1. Design a microprocessing system to implement a 3-speed stepper motor. Your design is constrained to use the parts shown in Fig. 1 and described

More information

EECE 340 Introduction to Microprocessors w/lab Section A. Term Project Parking Visitor Counter

EECE 340 Introduction to Microprocessors w/lab Section A. Term Project Parking Visitor Counter Section A Term Project Parking Visitor Counter Group Members: Instructor: Dr. Jinane Biri Due date: Sunday, Dec. 16, 2012 1 Table of Contents 1. Objective... 2 2. Introduction and Problem Description...

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

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud. Chapter 1 Microprocessor architecture ECE 3130 Dr. Mohamed Mahmoud The slides are copyright protected. It is not permissible to use them without a permission from Dr Mahmoud http://www.cae.tntech.edu/~mmahmoud/

More information

MARIE: An Introduction to a Simple Computer

MARIE: An Introduction to a Simple Computer MARIE: An Introduction to a Simple Computer 4.2 CPU Basics The computer s CPU fetches, decodes, and executes program instructions. The two principal parts of the CPU are the datapath and the control unit.

More information

Assembly Language Programming of 8085

Assembly Language Programming of 8085 Assembly Language Programming of 8085 1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor understands

More information

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss Grundlagen Microcontroller Interrupts Günther Gridling Bettina Weiss 1 Interrupts Lecture Overview Definition Sources ISR Priorities & Nesting 2 Definition Interrupt: reaction to (asynchronous) external

More information

ELECTRICAL ENGINEERING

ELECTRICAL ENGINEERING Serial : 1. JP_EE_Microprocessor_130618 CLASS TEST Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: E-mail: info@madeeasy.in Ph: 011-45124612 ELECTRICAL ENGINEERING

More information

Microcontroller Intel [Instruction Set]

Microcontroller Intel [Instruction Set] Microcontroller Intel 8051 [Instruction Set] Structure of Assembly Language [ label: ] mnemonic [operands] [ ;comment ] Example: MOV R1, #25H ; load data 25H into R1 2 8051 Assembly Language Registers

More information

Small Computer Monitor User Guide

Small Computer Monitor User Guide Small Computer Monitor User Guide Monitor version 0.5 for the Z80 CPU Software and Documentation by Stephen C Cousins Edition 0.5.0 CONTENTS OVERVIEW...3 Conventions... 3 Serial port... 4 RC2014 systems...

More information

Description of the Simulator

Description of the Simulator Description of the Simulator The simulator includes a small sub-set of the full instruction set normally found with this style of processor. It includes advanced instructions such as CALL, RET, INT and

More information

www.vidyarthiplus.com www.vidyarthiplus.com www.vidyarthiplus.com www.vidyarthiplus.com www.vidyarthiplus.com Time : Three hours Reg. No. : B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011 Sixth

More information

Subroutines and the Stack

Subroutines and the Stack 3 31 Objectives: A subroutine is a reusable program module A main program can call or jump to the subroutine one or more times The stack is used in several ways when subroutines are called In this lab

More information

CS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri

CS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri CS356: Discussion #6 Assembly Procedures and Arrays Marco Paolieri (paolieri@usc.edu) Procedures Functions are a key abstraction in software They break down a problem into subproblems. Reusable functionality:

More information

Small Computer Monitor User Guide

Small Computer Monitor User Guide Small Computer Monitor User Guide Monitor version 0.3 for the Z80 CPU Software and Documentation by Stephen C Cousins Edition 0.3.0 CONTENTS OVERVIEW... 3 Conventions... 3 Serial Port... 4 RC2014 Systems...4

More information

4 bits Microcontroller

4 bits Microcontroller EM MICROELECTRONIC - MARIN SA Question & answer 4 bits Microcontroller Questions and s Copyright 2001, EM Microelectronic-Marin SA 1 www.emmicroelectronic.com 1 Q: Is there an instruction to rotate left

More information

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313) Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 02/06/2018 Section 1 Weighting 40% of

More information

Loops. Repeat after me

Loops. Repeat after me Loops Repeat after me 1 Loops A loop is a control structure in which a statement or set of statements execute repeatedly How many times the statements repeat is determined by the value of a control variable,

More information

MICROPROCESSORS & MICRO CONTROLLER COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

MICROPROCESSORS & MICRO CONTROLLER COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK KINGS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK SUBJECT CODE: EC1257 SUBJECT NAME: MICROPROCESSOR AND MICROCONTROLLER YEAR : II IT SEM : IV UNIT I THE 8085 MICROPROCESSOR

More information

We briefly explain an instruction cycle now, before proceeding with the details of addressing modes.

We briefly explain an instruction cycle now, before proceeding with the details of addressing modes. Addressing Modes This is an important feature of computers. We start with the known fact that many instructions have to include addresses; the instructions should be short, but addresses tend to be long.

More information

8051 Microcontroller

8051 Microcontroller 8051 Microcontroller 1 Salient Features (1). 8 bit microcontroller originally developed by Intel in 1980. (2). High-performance CMOS Technology. (3). Contains Total 40 pins. (4). Address bus is of 16 bit

More information

MSMF GATE CENTRE. Sub: MICROPROCESSORS. Time: 50min Date: Marks:33

MSMF GATE CENTRE. Sub: MICROPROCESSORS. Time: 50min Date: Marks:33 MSMF GATE CENTRE Sub: MICROPROCESSORS Time: 50min Date:20-12-16 Marks:33 1. Which interrupt has highest priority in 8085 microprocessor? a) INTR b) RST 4.5 c) RST 6.5 d) RST 7.5 2. In 8085 microprocessor,

More information

APPENDIX D FLOWCHARTS AND PSEUDOCODE OVERVIEW

APPENDIX D FLOWCHARTS AND PSEUDOCODE OVERVIEW APPENDIX D FLOWCHARTS AND PSEUDOCODE OVERVIEW This appendix provides an introduction to writing flowcharts and pseudocode. 689 Flowcharts If you have taken any previous programming courses, you are probably

More information

HT8 UL60730 Safety Library -- Program Counter Register Test

HT8 UL60730 Safety Library -- Program Counter Register Test HT8 UL60730 Safety Library -- Program Counter Register Test D/N: AN0385E Introduction In general, the UL/CSA 60730 safety standard applies to automatic electrical controls for use in, on, or in association

More information

Chip-8 Design Specification

Chip-8 Design Specification Columbia University Embedded Systems 4840 Chip-8 Design Specification Authors: Ashley Kling (ask2203) Levi Oliver (lpo2105) Gabrielle Taylor (gat2118) David Watkins (djw2146) Supervisor: Prof. Stephen

More information

Computer Architecture

Computer Architecture Computer Architecture Lecture 1: Digital logic circuits The digital computer is a digital system that performs various computational tasks. Digital computers use the binary number system, which has two

More information

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers 1. Define microprocessors? UNIT-I A semiconductor device(integrated circuit) manufactured by using the LSI technique. It includes

More information

Basics of Microprocessor

Basics of Microprocessor Unit 1 Basics of Microprocessor 1. Microprocessor Microprocessor is a multipurpose programmable integrated device that has computing and decision making capability. This semiconductor IC is manufactured

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Interrupts (II) Interrupts in AVR External interrupts Internal interrupts Timers/Counters Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week7 1 S2, 2008 COMP9032

More information

Unit I. Introduction Microcontrollers and Embedded processors Overview of the 8051 Inside the 8051 Addressing Modes

Unit I. Introduction Microcontrollers and Embedded processors Overview of the 8051 Inside the 8051 Addressing Modes Unit I Introduction Microcontrollers and Embedded processors Overview of the 8051 Inside the 8051 Addressing Modes 1.1.1. Basic Introduction 1.1.1. Basic Introduction (contd.) 1.1.1. Basic Introduction

More information

Course Syllabus of Microprocessor I (Fall 2006)

Course Syllabus of Microprocessor I (Fall 2006) Course Syllabus of 16.317 Microprocessor I (Fall 2006) Table of contents 1 Basic Information...2 2 Course structure... 2 3 Service Learning... 3 4 Textbook... 3 5 Course Objectives... 3 6 Labs...5 7 Homeworks...

More information

The due date for submitting this assignment has passed. 1) How many times will the following loop be executed? Depends on the initial value of A

The due date for submitting this assignment has passed. 1) How many times will the following loop be executed? Depends on the initial value of A X reviewer2@nptel.iitm.ac.in Courses» and Microcontrollers Unit 4 - Week 3 Announcements Course Ask a Question Progress Mentor Course outline How to access the portal Week 3 Assignment The due date for

More information

EXPERIMENT NO.1. A Microcontroller is a complete computer system built on a single chip.

EXPERIMENT NO.1. A Microcontroller is a complete computer system built on a single chip. EXPERIMENT NO.1 AIM: Study of 8051 Microcontroller TOOLS: 8051 kit THEORY: Salient Features of 8051 A Microcontroller is a complete computer system built on a single chip. It contains all components like

More information

Chapter 1 Microprocessor architecture ECE 3120 Dr. Mohamed Mahmoud http://iweb.tntech.edu/mmahmoud/ mmahmoud@tntech.edu Outline 1.1 Computer hardware organization 1.1.1 Number System 1.1.2 Computer hardware

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

Department of Computer Science and Engineering

Department of Computer Science and Engineering Department of Computer Science and Engineering QUESTION BANK Subcode/Subject : CS1304 Microprocessor & Microcontroller Year/Sem: III / V UNIT I THE 8085 MICROPROCESSOR PART A ( 2Marks) 1. How AD0-AD7 are

More information

Chapter 3. Z80 Instructions & Assembly Language. Von Neumann Architecture. Memory. instructions. program. data

Chapter 3. Z80 Instructions & Assembly Language. Von Neumann Architecture. Memory. instructions. program. data Von Neumann Architecture The von Neumann architecture is a computer design model that uses a processing unit and a separate storage to hold both instructions and data To run a machine, program and data

More information

Code segment Stack segment

Code segment Stack segment Registers Most of the registers contain data/instruction offsets within 64 KB memory segment. There are four different 64 KB segments for instructions, stack, data and extra data. To specify where in 1

More information

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

UNIT-II. Part-2: CENTRAL PROCESSING UNIT Page1 UNIT-II Part-2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:

More information

Chapter 5 Sections 1 6 Dr. Iyad Jafar

Chapter 5 Sections 1 6 Dr. Iyad Jafar Building Assembler Programs Chapter 5 Sections 1 6 Dr. Iyad Jafar Outline Building Structured Programs Conditional Branching Subroutines Generating Time Delays Dealing with Data Example Programs 2 Building

More information

The Microcontroller. Lecture Set 3. Major Microcontroller Families. Example Microcontroller Families Cont. Example Microcontroller Families

The Microcontroller. Lecture Set 3. Major Microcontroller Families. Example Microcontroller Families Cont. Example Microcontroller Families The Microcontroller Lecture Set 3 Architecture of the 8051 Microcontroller Microcontrollers can be considered as self-contained systems with a processor, memory and I/O ports. In most cases, all that is

More information

Module 3. Embedded Systems I/O. Version 2 EE IIT, Kharagpur 1

Module 3. Embedded Systems I/O. Version 2 EE IIT, Kharagpur 1 Module 3 Embedded Systems I/O Version 2 EE IIT, Kharagpur 1 Lesson 15 Interrupts Version 2 EE IIT, Kharagpur 2 Instructional Objectives After going through this lesson the student would learn Interrupts

More information

Assembly Language Programming of 8085

Assembly Language Programming of 8085 Assembly Language Programming of 8085 Topics 1. Introduction 2. Programming model of 8085 3. Instruction set of 8085 4. Example Programs 5. Addressing modes of 8085 6. Instruction & Data Formats of 8085

More information

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics Moodle 4 WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics Advanced Microprocessors and Introduction to Microcontroller Moodle developed By Dr. S. R. Kumbhar Department of Electronics Willingdon

More information

PART - B (Answer all five units, 5 X 10 = 50 Marks)

PART - B (Answer all five units, 5 X 10 = 50 Marks) Code: 13A04507 R13 B.Tech III Year I Semester (R13) Supplementary Examinations June 2017 MICROPROCESSS & INTERFACING (Common to CSE & IT) PART - A (a) Mention the function of the instruction ADD M of 8085

More information

Contents 8051 Instruction Set BY D. BALAKRISHNA, Research Assistant, IIIT-H Chapter I : Control Transfer Instructions Lesson (a): Loop Lesson (b): Jump (i) Conditional Lesson (c): Lesson (d): Lesson (e):

More information

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller of 8085 microprocessor 8085 is pronounced as "eighty-eighty-five" microprocessor. It is an 8-bit microprocessor designed by Intel in 1977 using NMOS technology. It has the following configuration 8-bit

More information

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad Introduction to MS-DOS Debugger DEBUG In this laboratory, we will use DEBUG program and learn how to: 1. Examine and modify the contents of the 8086 s internal registers, and dedicated parts of the memory

More information

8051 Microcontrollers

8051 Microcontrollers 8051 Microcontrollers Richa Upadhyay Prabhu NMIMS s MPSTME richa.upadhyay@nmims.edu March 8, 2016 Controller vs Processor Controller vs Processor Introduction to 8051 Micro-controller In 1981,Intel corporation

More information

Three criteria in Choosing a Microcontroller

Three criteria in Choosing a Microcontroller The 8051 Microcontroller architecture Contents: Introduction Block Diagram and Pin Description of the 8051 Registers Some Simple Instructions Structure of Assembly language and Running an 8051 program

More information

FE Review Computer Terms

FE Review Computer Terms FE Review Computer Terms 2/2/2011 1 Computers sizes Supercomputers Mainframe centralized, large memory, large peripherals Mini-computers Less memory, smaller Microcomputers smaller still few peripherals,

More information

1. What is Microprocessor? Give the power supply & clock frequency of 8085?

1. What is Microprocessor? Give the power supply & clock frequency of 8085? 1. What is Microprocessor? Give the power supply & clock frequency of 8085? A microprocessor is a multipurpose, programmable logic device that reads binary instructions from a storage device called memory

More information

VALLIAMMAI ENGINEERING COLLEGE S.R.M. NAGAR, KATTANKULATHUR-603203. DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING VII-EEE EE6502- MICROPROCESSORS AND MICROCONTROLLERS QUESTION BANK UNIT I 1. What

More information

Practical Course File For

Practical Course File For Practical Course File For Microprocessor (IT 473) B.Tech (IT) IV-SEM Department of IT University Institute of Engineering & Technology Panjab University, Chandigarh Page 1 INTRODUCTION... 4 EXPERIMENT-1:

More information

Computer Systems Lecture 9

Computer Systems Lecture 9 Computer Systems Lecture 9 CPU Registers in x86 CPU status flags EFLAG: The Flag register holds the CPU status flags The status flags are separate bits in EFLAG where information on important conditions

More information

Sencer Yeralan and Helen Emery Gainesville, Florida January 2000

Sencer Yeralan and Helen Emery Gainesville, Florida January 2000 Preface This book is an outgrowth of the notes and experiments developed for the graduate classes at the University of Florida. It is intended for students, hobbyists, engineers, and scientists who would

More information

Today s Menu. >Use the Internal Register(s) >Use the Program Memory Space >Use the Stack >Use global memory

Today s Menu. >Use the Internal Register(s) >Use the Program Memory Space >Use the Stack >Use global memory Today s Menu Methods >Use the Internal Register(s) >Use the Program Memory Space >Use the Stack >Use global memory Look into my See examples on web-site: ParamPassing*asm and see Methods in Software and

More information

Its Assembly language programming

Its Assembly language programming 8085 Architecture & Its Assembly language programming Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati 8085 Era and Features 8085 Outline Block diagram (Data Path) Bus Structure Register Structure

More information

1 = Enable SOD 0 = Disable SOD. Serial Output Data. Fig.12.9 SIM Instruction Format

1 = Enable SOD 0 = Disable SOD. Serial Output Data. Fig.12.9 SIM Instruction Format Lecture-67 The 8085 Serial I/O Lines: SOD & SID The 8085 microprocessor has two pins specially designed for software control serial I/O. One is called SOD (serial output data) and the other is called SID

More information

MICROCONTROLLER AND PLC LAB-436 SEMESTER-5

MICROCONTROLLER AND PLC LAB-436 SEMESTER-5 MICROCONTROLLER AND PLC LAB-436 SEMESTER-5 Exp:1 STUDY OF MICROCONTROLLER 8051 To study the microcontroller and familiarize the 8051microcontroller kit Theory:- A Microcontroller consists of a powerful

More information

Loops and Files. Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz

Loops and Files. Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Loops and Files Chapter 04 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Chapter Topics o The Increment and Decrement Operators o The while Loop o Shorthand Assignment Operators o The do-while

More information

Mechatronics and Microcomputers. Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD

Mechatronics and Microcomputers. Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD Mechatronics and Microcomputers Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD ATmega128 CPU Single-level pipelining Egyciklusú ALU működés Reg. reg., reg. konst. közötti műveletek

More information

PRODUCT OVERVIEW OVERVIEW

PRODUCT OVERVIEW OVERVIEW PRODUCT OVERVIEW 1 PRODUCT OVERVIEW OVERVIEW The S3C70F2/C70F4 single-chip CMOS microcontroller has been designed for high-performance using Samsung's newest 4-bit CPU core, SAM47 (Samsung Arrangeable

More information

Digital IP Cell 8-bit Microcontroller PE80

Digital IP Cell 8-bit Microcontroller PE80 1. Description The is a Z80 compliant processor soft-macro - IP block that can be implemented in digital or mixed signal ASIC designs. The Z80 and its derivatives and clones make up one of the most commonly

More information

Computer Organization and Technology Processor and System Structures

Computer Organization and Technology Processor and System Structures Computer Organization and Technology Processor and System Structures Assoc. Prof. Dr. Wattanapong Kurdthongmee Division of Computer Engineering, School of Engineering and Resources, Walailak University

More information

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture Department of Electrical Engineering Lecture 4 The 8051 Architecture 1 In this Lecture Overview General physical & operational features Block diagram Pin assignments Logic symbol Hardware description Pin

More information

Marking Scheme. Examination Paper. Module: Microprocessors (630313)

Marking Scheme. Examination Paper. Module: Microprocessors (630313) Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 12/06/2017 Section 1 Weighting 40% of

More information

DEPARTMENT OF ECE QUESTION BANK SUBJECT: MICROPROCESSOR AND MICROCONTROLLER UNIT-1 PART-A (2 MARKS)

DEPARTMENT OF ECE QUESTION BANK SUBJECT: MICROPROCESSOR AND MICROCONTROLLER UNIT-1 PART-A (2 MARKS) DEPARTMENT OF ECE QUESTION BANK SUBJECT: MICROPROCESSOR AND MICROCONTROLLER CODE: EC6504 UNIT-1 1. How many memory locations are available in 8086 microprocessor? 2. What are the flags available in 8086

More information

THE 8051 MICROCONTROLLER

THE 8051 MICROCONTROLLER SECOND EDITION THE 8051 MICROCONTROLLER I. Scott MacKenzie University of Guelph Guelph, Ontario 'v ' ' Prentice Hall, Upper Saddle River, New Jersey 07458 INTRODUCTION TO MICROCONTROLLERS 1 1.1 Introduction

More information

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING CHAPTER 2 8051 ASSEMBLY LANGUAGE PROGRAMMING Registers Register are used to store information temporarily: A byte of data to be processed An address pointing to the data to be fetched The vast majority

More information

Unit wise Question Bank UNIT-II

Unit wise Question Bank UNIT-II Academic year: 2017-18 Program: B Tech Course Title: Microprocessor & Microcontrollers Unit wise Question Bank Year/Semester: III/I Section: A, B & C Branch: ECE UNIT-I 1. Draw the functional pin diagram

More information