Microprocessor Interfacing Laboratory Bachelor Degree in Engineering

Total Page:16

File Type:pdf, Size:1020Kb

Microprocessor Interfacing Laboratory Bachelor Degree in Engineering A Laboratory Manual for Microprocessor Interfacing Laboratory (210254) Semester – IV (Computer Engineering) Bachelor Degree in Engineering UNIVERSITY OF PUNE, GANESHKHIND SNJB’s KBJ College Of Engineering, Chandwad DEPARTMENT OF COMPUTER ENGINEERING LABORATORY MANUAL DEVELOPMENT PROJECT Designations Team for design Project Institution Shri Neminath Jain Bramhacharyashram’s SNJB’s KBJ College of Engineering, Neminagar, Chandwad -423101. Project Commencement Dec 2012 Head Of Institution Prof. J. J. Chopade SNJB’s KBJ College of Engineering, Neminagar, Chandwad -423101. Chief Project Coordinator Mr. M .R Sanghavi Head,DepartmentOfComputerEngineering, SNJB’s KBJ College of Engineering, Neminagar, Chandwad -423101. Project Coordinator Ms. K. S. Kotecha AssociateProfessor,DepartmentOfComputer Engineering,KBJ College of Engineering, Neminagar, Chandwad -423101. Subject Experts 1. Mr.V.V Agrawal SNJB’s KBJ College of Engineering, Neminagar, Chandwad -423101 2. Mr.R.R.Bhandari SNJB’s KBJ College of Engineering, Neminagar, Chandwad -423101 JB’s KBJ College Of Engineering, Chandwad DEPARTMENT OF COMPUTER ENGINEERING Certificate This is Certify that Mr/Ms. Com__________________puter Roll No _of Fourth Semester of BacMicroprocessorhelor Engineer Interfacinging in Laboratoryhas completed the term work satisfactorily in in the Academic Year 20_ to 20_ as prescribed in the curriculum. Place Date: Exam Seat No. Subject Teacher Head of Department Principal Stamp of Institution List of Experiment and Record of Progressive Assessment Sr. Name of Experiment Pag Date of Date of Assessment Sign of e No Performance Submission Marks Teacher Write X86 Assembly language N program (ALP) to add array of o 1 N hexadecimal numbers stored in the memory. Accept input from the user. Write 8086 ALP to perform non-overlapped and overlapped 2 block transfer (with and without string specific instructions). Block containing data can be defined in the data segment. Write X86 ALP to convert 4- digit Hex number into its 3 equivalent BCD number and 5- digit BCD number into its equivalent HEX number. Make your program user friendly to accept the choice from user for: (a)HEX to BCD b) BCD to HEX (c) EXIT. Display proper strings to prompt the user while accepting the input and displaying the result. Write 8086 ALP for the following operations on the string 4 entered by the user. a) Calculate Length of the string b) Reverse the string c) Check whether the string is palindrome OR Make your program user friendly by providing MENU like: (a) Enter the string b) Calculate length of string c) Reverse string d) Check palindrome e) Exit Display appropriate messages to prompt the user while accepting the input and displaying the result. Write 8086 ALP to perform string manipulation. The strings 5 to be accepted from the user is to be stored in data segment of program_l and write FAR PROCEDURES in code segment program_2 for following operations on the string: (a) Concatenation of two strings (b) Number of occurrences of a sub-string in the given string Use PUBLIC and EXTERN directive. Create .OBJ files of both the modules and link them to create an EXE file. Write X86 ALP to perform multiplication of two 8-bit 6 hexadecimal numbers. Use successive addition and add and shift method. Accept input from the user. Write 8087ALP to obtain: i) Mean ii) Variance iii) Standard 7 Deviation For a given set of data elements defined in data segment. Also display result. Write 8086 ALP to convert an analog signal in the range of 0V 8 to 5V to its corresponding digital signal using successive approximation ADC and dual slope ADC. Find resolution used in both the ADC's and compare the results. Write 8086 ALP to interface DAC and generate following 9 waveforms on oscilloscope, (i) Square wave - Variable Duty Cycle and Frequency. (ii) Ramp wave - Variable direction, (iii) Trapezoidal wave (iv) Stair case wave Write 8086 ALP to program 8253 in Mode 0, modify the program for hardware retriggerable 10.Monoshot mode. Generate a square wave with a pulse of 1 ms. Comment on the difference between Hardware Triggered and software triggered strobe mode. Observe the waveform at GATE & out pin of 1C 8254 on CRO 11 Perform an experiment to establish communication between two 8251 systems A and B. Program 8251 system A in asynchronous transmitter mode and 8251 system B in asynchronous receiver mode. Write an ALP to transmit the data from system A and receive the data at system B. The requirements are as follows: Transmission: • message is stored as ASCII characters in the memory. • message specifies the number of characters to be transmitted as the first byte. Reception: • Message is retrieved and stored in the memory. • Successful reception should be indicated. 12 Write a TSR program in 8086 ALP to implement Real Time Clock (RTC). Read the Real Time from CMOS chip by suitable INT and FUNCTION and display the RTC at the bottom right corner on the screen. Access the video RAM directly in your routine. 13 Study Assignment Microprocessor and Interfacing Laboratory Second Year Computer Engineering Att (2) Perm(5) Oral(3) Total(10) Sign with Date Assignment 1 Problem Definition: Write X86/64 Assembly language program (ALP) to add array of N hexadecimal numbers stored 1.1 Prerequisites: Concepts of in the memory. Accept input from the user. Program Algorithm Registers Assembly language Assembler Array & its scope 1.2 Learning Objectives: Understand the implementation Understand the implementation of the arithmetic instruction of 80386. 1.3 New concepts:- 1.3.1 What is ALP? Assembly language Program is mnemonic representation of machine code. 1.3.2 Which assembler used in execution of ALP? Three assemblers available for assembling the programs for IBM-PC are: 1. Microsoft Micro Assembler(MASM) 2. Borland Turbo Assembler (TASM) 3. Net wide Assembler (NASM) 1.4 Theory 1.4.1 Assemblydata Basic Syntax An assemblybss program can be divided into three sections: 1. The text section 2. The section 3. The section SNJB’s Late Sau. KBJ COLLEGE OF ENGINEERING Page 7 Microprocessor and Interfacing Laboratory Second Year Computer Engineering The data Section data The section is used for declaring initialized data or constants. This data does not change at runtime.section Youcan.data declare various constant values, file names or buffer size etc. in this section. The syntax for declaring data section is: The bss Section section .bss The bss section is used for declaring variables. The syntax for declaring bss section is: The text section The text section is used for keeping the actual code. This section must begin with the declarationglobal main, sectionwhich tells .text the kernel where the program execution begins. Theglobal syntax main for declaring text section is: main: Assembly Language Statements Assembly language programs consist of three types of statements: 1. Executable instructions or instructions 2. Assembler directives or pseudo-ops 3. Macros executable instructions instructions operation code The or simply tell the processor what to do. Each instructionassembler consists directives of an pseudo-ops(opcode). Each executable instruction generates one machine language instruction. The or tell the assembler about the various aspects of the Macrosassembly process. These are non-executable and do not generate machine language instructions. Assemblyare System basically Calls a text substitution mechanism. System calls are APIs for the interface between user space and kernel space. We are using the system calls sys_write and sys_exit for writing into the screen and exiting from the program Linuxrespectively. System Calls You can make use of Linux system calls in your assembly programs. You need to take the following steps for using Linux system calls in your program: Put the system call number in the EAX register. SNJBStore’s Late theSau. arguments KBJ COLL toEGE the systemOF ENG callINE inE RtheING registers EBX, ECX, etc. Page 8 Microprocessor and Interfacing Laboratory Second Year Computer Engineering Call the relevant interrupt (80h) The result is usually returned in the EAX register There are six registers that stores the arguments of the system call used. These are the EBX, ECX, EDX, ESI, EDI, and EBP. These registers take the consecutive arguments, starting with the EBX Theregister. following If there code are snippetmore than shows six arguments the use of thenthe system the memory call sys_exit: location of the first argument is stored in the EBX register. The followingMOV EAX code, 1 snippet; system shows call numberthe use (sys_exit)of the system call sys_write: INT 0x80 ; call kernel MOV EDX, 4 ; message length MOV ECX, MSG ; message to write MOV EBX,1 ; file descriptor (stdout) MOV EAX,4 ; system call number (sys_write) INT 0x80 ; call kernel The following table shows some of the system calls: Assembly Variables define directives NASM provides various for reserving storage space for variables. The define Assembler directive is used for allocation of storage space. It can be used to reserve as well as initialize one or more bytes. SNJB’s Late Sau. KBJ COLLEGE OF ENGINEERING Page 9 Microprocessor and Interfacing Laboratory Second Year Computer Engineering Allocating Storage Space for Initialized Data There are five basic forms of the define directive: Allocating Storage Space for Uninitialized Data The reserve directives are used for reserving space for uninitialized data. The reserve directives take a single operand that specifies the number of units of space to be reserved. Each define directive has a related reserve directive. There are five basic forms of the reserve directive: 1.6 Instructions needed: 1. MOV-Copies byte or word from specified source to specified destination 2. ROR-Rotates bits of byte or word right, LSB to MSB and to CF 3. AND-AND each bit in a byte or word with corresponding bit in another byte or word 4. INC-Increments specified byte/word by 1 5. DEC-Decrements specified byte/word by 1 6.
Recommended publications
  • Assembly Language Tutorial
    Assembly Language Tutorial ASSEMBLY LANGUAGE TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Assembly Programming Tutorial Assembly language is a low-level programming language for a computer, or other programmable device specific to a particular computer architecture in contrast to most high- level programming languages, which are generally portable across multiple systems. Assembly language is converted into executable machine code by a utility program referred to as an assembler like NASM, MASM etc. Audience This tutorial has been designed for software programmers with a need to understand the Assembly programming language starting from scratch. This tutorial will give you enough understanding on Assembly programming language from where you can take yourself at higher level of expertise. Prerequisites Before proceeding with this tutorial you should have a basic understanding of Computer Programming terminologies. A basic understanding of any of the programming languages will help you in understanding the Assembly programming concepts and move fast on the learning track. TUTORIALS POINT Simply Easy Learning Copyright & Disclaimer Notice All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorial content contains some errors, please contact us at [email protected] TUTORIALS POINT Simply Easy Learning Table of Content Assembly Programming Tutorial .............................................
    [Show full text]
  • PC Assembly Language
    PC Assembly Language Paul A. Carter August 25, 2002 Copyright c 2001, 2002 by Paul Carter This may be reproduced and distributed in its entirety (including this au- thorship, copyright and permission notice), provided that no charge is made for the document itself, without the author’s consent. This includes “fair use” excerpts like reviews and advertising, and derivative works like trans- lations. Note that this restriction is not intended to prohibit charging for the service of printing or copying the document. Instructors are encouraged to use this document as a class resource; however, the author would appreciate being notified in this case. Contents Preface iii 1 Introduction 1 1.1 Number Systems . 1 1.1.1 Decimal . 1 1.1.2 Binary . 1 1.1.3 Hexadecimal . 3 1.2 Computer Organization . 4 1.2.1 Memory . 4 1.2.2 The CPU . 5 1.2.3 The 80x86 family of CPUs . 5 1.2.4 8086 16-bit Registers . 6 1.2.5 80386 32-bit registers . 7 1.2.6 Real Mode . 8 1.2.7 16-bit Protected Mode . 8 1.2.8 32-bit Protected Mode . 9 1.2.9 Interrupts . 10 1.3 Assembly Language . 10 1.3.1 Machine language . 10 1.3.2 Assembly language . 11 1.3.3 Instruction operands . 11 1.3.4 Basic instructions . 12 1.3.5 Directives . 13 1.3.6 Input and Output . 15 1.3.7 Debugging . 16 1.4 Creating a Program . 17 1.4.1 First program . 18 1.4.2 Compiler dependencies .
    [Show full text]
  • Assembly Language for X86 Processors
    Assembly Language for x86 Processors Sixth Edition KIP R. IRVINE Florida International University School of Computing and Information Sciences Upper Saddle River Boston Columbus San Francisco New York Indianapolis London Toronto Sydney Singapore Tokyo Montreal Dubai Madrid Hong Kong Mexico City Munich Paris Amsterdam Cape Town Vice President and Editorial Director, ECS: Marcia J. Horton Editor-in-Chief: Michael Hirsch Executive Editor: Tracy Dunkelberger Assistant Editor: Melinda Haggerty Editorial Assistant: Allison Michael Vice President, Production: Vince O’Brien Senior Managing Editor: Scott Disanno Production Liaison: Jane Bonnell Production Editor: Maheswari PonSaravanan, TexTech International Senior Operations Supervisor: Alan Fischer Marketing Manager: Erin Davis Marketing Assistant: Mack Patterson Art Director: Kenny Beck Cover Designer: Laura C. Ierardi Cover Image: Color enhanced x-ray of nautilus shell / Bert Myers / Science Photo Library Art Editor: Greg Dulles Media Editor: Daniel Sandin Media Project Manager: Danielle Leone Composition/Full-Service Project Management: TexTech International IA-32, Pentium, i486, Intel64, Celeron, and Intel 386 are trademarks of Intel Corporation. Athlon, Phenom, and Opteron are trademarks of Advanced Micro Devices. TASM and Turbo Debugger are trademarks of Borland International. Microsoft Assembler (MASM), Windows Vista, Windows 7, Windows NT, Windows Me, Windows 95, Windows 98, Windows 2000, Windows XP, MS-Windows, PowerPoint, Win32, DEBUG, WinDbg, MS-DOS, Visual Studio, Visual C++, and CodeView are registered trademarks of Microsoft Corporation. Autocad is a trademark of Autodesk. Java is a trademark of Sun Microsystems. PartitionMagic is a trademark of Symantec. All other trademarks or product names are the property of their respective owners. Copyright © 2011, 2007, 2003, 1999 by Pearson Education, Inc., Upper Saddle River, New Jersey 07458.
    [Show full text]
  • MICROPROCESSOR INTERFACING LABORATORY Course / Branch Computer Engineering (2012 Course)
    Microprocessor & Interfacing techniques SE (Comp) SHREE RAMCHANDRA COLLEGE OF ENGINEERING LAB MANUAL S.E. Computer Semester- IV Dec 2015 –Apr 2016 Subject Code / Subject (210248) MICROPROCESSOR INTERFACING LABORATORY Course / Branch Computer Engineering (2012 course) Teaching Scheme Examination Scheme Lectures:3Hrs/Week Theory: 50 Marks Practical: 4Hrs/Week Online: 50 Marks Term Work: 50 Marks Department of Computer Engineering SRCOE, Pune-412216 Page 1 Microprocessor & Interfacing techniques SE (Comp) Sr. Name of the Practical No. GROUP A 1 Write X86/64 Assembly language program (ALP) to add array of N hexadecimal numbers stored in thememory. Accept input from the user. 2 Write X86/64 ALP to perform non-overlapped and overlapped block transfer (with and without stringspecific instructions). Block containing data can be defined in the data segment. 3 Write 64 bit ALP to convert 4-digit Hex number into its equivalent BCD number and 5-digit BCD numberinto its equivalent HEX number. Make your program user friendly to accept the choice from user for: (a) HEX to BCD b) BCD to HEX (c) EXIT. Display proper strings to prompt the user while accepting the input and displaying the result. (use of 64-bitregisters is expected) 4 Write X86/64 ALP for the following operations on the string entered by the user. (use of 64-bit registers isexpected) Make your program user friendly by providing MENU like: (a) Enter the string b) Calculate length of string c) Reverse string d) Check palindrome e) Exit Display appropriate messages to prompt the user while accepting the input and displaying the result. 5 Write X86/64 ALP to perform multiplication of two 8-bit hexadecimal numbers.
    [Show full text]
  • The Art of Assembly Language the Art of Assembly Language (Brief Contents)
    The Art of Assembly Language The Art of Assembly Language (Brief Contents) Forward Why Would Anyone Learn This Stuff? ................................................................ 1 Section One: ...................................................................................................................... 9 Chapter One Data Representation ..................................................................................... 11 Chapter Two Boolean Algebra .......................................................................................... 43 Chapter Three System Organization .................................................................................. 83 Chapter Four Memory Layout and Access ......................................................................... 145 Section Two: ...................................................................................................................... 193 Chapter Five Variables and Data Structures ...................................................................... 195 Chapter Six The 80x86 Instruction Set ............................................................................... 243 Chapter Seven The UCR Standard Library ......................................................................... 333 Chapter Eight MASM: Directives & Pseudo-Opcodes ....................................................... 355 Chapter Nine Arithmetic and Logical Operations ............................................................. 459 Chapter 10 Control Structures ...........................................................................................
    [Show full text]
  • Programming Interrupts for DOS-Based Data Acquisition on 80X86-Based Computers T
    Application Note 010 Programming Interrupts for DOS-Based Data Acquisition on 80x86-Based Computers T. Hayles and D. Potter Introduction This application note explains how to use interrupt programming on computers based on the 80x86 family of microprocessors running the DOS operating system. This family includes the 8086, 8088, 80286, 80386, and 80486 microprocessors that are used in PC/XT/AT, EISA, and IBM PS/2 computers. This application note describes interrupts, explains how interrupts work and how they are implemented on 80x86-based computers, and discusses programming guidelines when designing an interrupt-driven DOS application. Finally, this application note contains example programming code to demonstrate how to program interrupts for a DOS-based data acquisition application. What Are Interrupts? Interrupts are very important to the operation of any computer. Interrupts give the processor the ability to respond quickly to its peripherals (such as the keyboard and the hard disk) and to the outside world in general. Without interrupts, a processor would be unable to service more than one task efficiently and reliably. The importance of the interrupt is illustrated when comparing an interrupt to a doorbell. If your door did not have a doorbell, you would have to periodically go to the door to see if anyone happened to be there at that time. Of course, that would be very inefficient. With a doorbell, you only need to go to the door when the doorbell rings, and you are then confident that someone is there waiting. Likewise, it is not efficient for the processor to continually check whether any of its peripherals require attention at a given time.
    [Show full text]