Professional Documents
Culture Documents
of ECE
Dept. of ECE
1. Students are required to attend all labs. 2. Students will work in a group of two in hardware laboratories and individually in computer laboratories. 3. While coming to the lab bring the lab manual cum observation book, record etc. 4. Take only the lab manual, calculator (if needed) and a pen or pencil to the work area. 5. Before coming to the lab, prepare the prelab questions. Read through the lab experiment to familiarize yourself with the components and assembly sequence. 6. Utilize 3 hours time properly to perform the experiment and noting down the readings. Do the calculations, draw the graph and take signature from the instructor. 7. If the experiment is not completed in the prescribed time, the pending work has to be done in the leisure hour or extended hours. 8. You will be expected to submit the completed record book according to the deadlines set up by your instructor. 9. For practical subjects there shall be a continuous evaluation during the semester for 25 sessional marks and 50 end examination marks. 10. Of the 25 marks for internal, 15 marks shall be awarded for day-to-day work and 10 marks to be awarded by conducting an internal laboratory test.
Dept. of ECE
S.No 1 2 3 4 5 6
CONTENTS OVERVIEW OF THE 80X86 FAMILY INTRODUCTION TO TASM PROCEDURE TO ENTER A PROGRAM USING TASM SOFTWARE: EXAMPLE FOR ASSEMBLE LANGUAGE PROGRAM EXECUTION OF PROGRAM THROUGH TRAINER KIT TRAINER KIT PROGRAMMES 1. ADDITION OF N 8 BIT NUMBERS 2. MULTI BYTE ADDITION 3. MULTIBYTE SUBTRACTION 4. MULTIPLICATION OF 16 BIT NUMBER 5. DIVISION OF 16 BIT NUMBER 6. FACTORIAL OF A GIVEN NUMBER
TASM PROGRAMMES 1. MULTI BYTE ADDITION 2. MULTI BYTE SUBTRACTION 3. 8 BIT MULTIPLICATION (UNSIGNED) 4. 8-BIT MULTIPLICATION (SIGNED) 5.16 BIT MULTIPLICATION (UNSIGNED) 6. 8 BIT DIVISION (UNSIGNED) 7. 8-BIT DIVISION (SIGNED) 8. 16 BIT DIVISION (UNSIGNED) 9. LARGEST OF A GIVEN NUMBER 10. ASCII ADDITION 11. ASCII SUBTRACTION 28-30 31-33 34-35 36-37 38-40 41-42 43-44 45-46 47-48 49-50 51-53
LOGIC OPERATIONS 1. CHECK WHETHER A GIVEN 16-BIT NUMBER IS EVEN OR ODD 2. CHECK WHETHER A GIVEN 16-BIT NUMBER IS POSITIVE OR NEGATIVE 54-55 56-57
Dept. of ECE
3. SORTING (ASCENDING) 4. SORTING (DESCENDING) 5. PACKED TO UNPACKED BCD 6. BCD to ASCII CONVERSION 9 STRING OPERATIONS 1. LENGTH OF THE STRING 2. BLOCK TRANSFER 3. STRING COMPARISION 4. STRING REVERSAL 5. STRING INSERTION 6. STRING DELETION 7. READING KEYBOARD WITH ECHO 8. READING KEYBOARD WITHOUT ECHO 9. DISPLAYING A CHARACTER 10. DISPLAYING A STRING INTERFACING 1. 8255 PPI INTERFACING -1 2. 8279 KEYBOARD/DISPLAY INTERFACING 3. 8259 PROGRAMMABLE INTERUPT CONTROLLER 4. 8251 USART APPENDIX
69-71 72-74 75-77 78-80 81-84 85-87 88-89 90-91 92-93 94-95
108-110 111-113
Dept. of ECE
Dept. of ECE
REGISTERS
Registers are places in the CPU where a number can be stored and manipulated. There are three sizes of registers: 8-bit, 16-bit and on 386 and above 32-bit. There are four different types of registers: - General Purpose Registers, - Segment Registers, - Index Registers, - Stack Registers.
SEGMENT REGISTERS
Code segment register CS- Stores the base address of Code segment Stack segment register -SS- Stores the Base address of stack Data segment register-DS- Stores the Base address of data Extra segment register-ES- Stores the Base address of the extra segment V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 6
Dept. of ECE
INDEX REGISTERS
These registers are sometimes called pointer registers. They are 16-bit registers and are mainly used for string instructions. There are three index registers SI (source index), DI (destination index) and IP (instruction pointer). On 386's and above there are also 32-bit index registers: EDI and ESI. You can also use BX to index strings.
STACK REGISTERS
BP and SP are stack registers and are used when dealing with the stack. We will discuss about them when we will talk about the stack. The designers of the 8088 decided that the maximum need for memory space will be one megabyte. So, the chip they build cannot go above that. The problem is to access a whole megabyte 20 bits are needed. But registers only have 16 bits so 4 more bites are needed. They came up with what they thought was a clever way to solve this problem: segments and offsets. This is a another way to do the addressing with two registers but not using 32 bits. To compute every single address the segment addresses as well as the offset are needed. A segment is usually 64kBytes long. To address a location inside a segment, we need the offset (16 bytes long).
THE STACK
As the number of registers used is low, how do they manage to manipulate the data? There is something called a stack which is an area of memory which you can save and restore values to. To physically imagine this we can consider a stack of plates. The last one you put on is the first one that you take off. This is sometimes referred to as Last On First Off (LOFO) or Last In First Out (LIFO). But, you have to be sure that you do not put to much data in the stack.
NUMBERS IN BINARY
Before we begin to understand how to program in assembly it is best to try to remember how numbers are represented in computers. Numbers are stored in binary, base two. There are several terms which are used to describe different size numbers: 1 BIT: 0 (can have the values 1 or 0) One bit is the simplest piece of information that exists. Its either a one or a zero. 1 NIBBLE: 0000 (4 BITS) V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 7
Dept. of ECE
The nibble is four bits or half a byte. It has a maximum value of 15 (1111 = 15). This is the basis for the hexadecimal (base 16) number system which is used as it is far easier to understand. Hexadecimal numbers that begin with a letter are prefixed with a 0 (zero). 1 BYTE: 00000000 (equivalent with 2 NIBBLES or 8 BITS) A byte is 8 bits or 2 nibbles. A byte has a maximum value of FFh (255 decimal). A WORD is a 2 byte data. The maximum value that can be represented using a word is 65535. It is the obvious that if bigger number has to be represented, the necessary number of bites will increase.
Above, MSD means Most Significant Digit and LSD means Least Significant Digit. A word will be represented as below:
In memory, bytes are stored one after another. Each one has an associated address. Often data needs more than one byte (every number greater then 256). Then we are going to use a word to represent this number. In 8086 programming, the Most Significant Byte is stored at higher address then LSB.
Dept. of ECE
2. INTRODUCTION TO TASM
INTRODUCTION:
The aim of this experiment is to introduce the student to assembly language programming and the use of the tools that he will need throughout the lab experiments. This first experiment let the student use the Dos Debugger and the Turbo Assembler (TASM). Editing, Assembling, Linking, Execute up can be done using TASM software
OBJECTIVES:
1. Introduction to Turbo Assembler (TASM) 2. General structure of an assembly language program 3. Use of the Dos Debugger program
OVERVIEW:
In general, programming of microprocessor usually takes several iterations before the right sequence of machine code instruction is written. The process, however is facilitated using a special program called an Assembler. The Assembler allows the user to write alphanumeric instructions. The Assembler, in turn, generates the desired machine instructions from the assembly language instructions.
1 2 3 4
ASSEMBLER:
The assembler is used to convert the assembly language instructions to machine code. It is used immediately after writing the Assembly language program. The assembler starts by checking the syntax or validity of the structure of each instruction in the source file .if any errors are found, the assemblers displays a report on these errors along with brief explanation of their nature. However if the program does contain any errors, the assembler produces an object file that has the same name as the original file but with the obj extension
Dept. of ECE
LINKER:
The Linker is used convert the object file to an executable file. A linker is a program used to join several object files in to one large object file and convert to an executable file. The linker produces a link file which contains the binary codes for all the combined modules. The linker however doesnt assign absolute address to the program it assigns is said to be relocatable because it can be put any where in memory to be run.
DEBUGGER:
The debugger can also be used to find logical errors in the program. Even if a program does not contain syntax errors it may not produce the desired results after execution. Logical errors may be found by tracing the action of the program. Once found, the source file should be rewrite to fix the problem, then the re-assembled and re-linked. A special program called the debugger is designed for that purpose. The debugger allows the user to trace the action of the program, by single stepping through the program or executing the program up to a desired point, called break point. It also allows the user to inspect or change the contents of the microprocessor internal registers or the contents of any memory location.
10
Dept. of ECE
11
Dept. of ECE
Create A file name with .asm extension Ex: Filename.asm Write the program in assemble language then Save and Quit It returns to DOS Prompt Use the following Commands D: \TASM> tasm filename.asm It is for viewing errors and warnings report exist in the asm file(refer Assembler)
D: \TASM> tlink filename.obj The assembler produces an object file that has the same name as the original file but with the obj extension
12
Dept. of ECE
Click Run and Click View It shows the output for Corresponding Inputs
13
Dept. of ECE
DB DB 00 00
04H 02H
In the code segment remaining the entire program with specified instructions are present Example: CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV AL, NUM1 MOV BL, NUM2 MUL BL MOV RESULT, AL MOV RESULT1, AH INT 3 CODE ENDS
14
Dept. of ECE
15
Dept. of ECE
BACK:
G0:
Dept. of ECE
INT 03 OBSERVATIONS: Input: S3000: 03 S3001: 02 Output: D4000:09 S3002:03 S3003:04 Output D4000: Input S3000: S3001: S3002: S3003:
RESULT: Thus the addition of n 8 bit numbers is performed and results are observed using 8086 microprocessor trainer kit. VIVA QUESTIONS: 1. What is Microprocessors 2. What are the functions of Accumulator? 3. MOV BL, [SI] which Addressing mode? 4. Basic Difference between 8085 and 8086
17
Dept. of ECE
BACK:
Dept. of ECE
OBSERVATIONS: Input: S3000 S3001 S3002 S3003 10 20 30 40 S4000 S4001 S4002 S4003 20 30 40 50 Output: D4000 D4001 D4002 D4003 30 50 70 90 Input: S3000 S3001 S3002 S3003
RESULT: Multi byte addition is performed and results are observed using TASM.
VIVA QUESTIONS 1. 2. 3. 4. Why 8085 processor is called an 8-bit processor What is the disadvantage of microprocessor? What is the difference between ADD & ADC What is the purpose served by CX register? 19
Dept. of ECE
3. MULTIBYTE SUBTRACTION
AIM: To write a program to subtract multibyte numbers APPARATUS: 8086 microprocessor trainer kit, power supply ALGORITHM: Step1: initialize AX// load SI with 3000h memory location Step2: load DI with 4000h memory location Step3: load the CX register with count 03 Step4: move the first byte of first number [SI] in to AL Step5: move the first byte of second number [DI] in to DL Step6: subtract AL from DL with borrow Step7: move the contents of AL in to DI Step8: increment SI Step9: increment DI Step10: move the second byte of first number [SI] in to AL Step11: move the second byte of second number [DI] in to DL Step12: subtract AL from DL with borrow Step13: move the contents of AL in to DI Step14: decrement CX and jump to the step 8 if the CX register is Non zero Step15: end of the program PROGRAM: MOV AX, 0000H MOV SI, 3000H MOV DI, 4000H MOV CX, 03 MOV AL, [SI] MOV DL, [DI] SBB AL, DL MOV [DI], AL INC SI INC DI MOV AL, [SI] MOV DL, [DI] SBB AL, DL MOV [DI], AL 20
BACK:
Dept. of ECE
OBSERVATIONS: Input: S3000 S3001 S3002 S3003 50 80 50 40 S4000 S4001 S4002 S4003 20 30 40 20 Output: D4000 D4001 D4002 D4003 30 50 10 20 Input: S3000 S3001 S3002 S3003 S4000 S4001 S4002 S4003 Output: D4000 D4001 D4002 D4003
RESULT: Thus multibyte subtraction is performed and results are observed using 8086 microprocessor kit
21
Dept. of ECE
22
Dept. of ECE
RESULT: Thus multiplication of a 16 bit numbers is performed and results are observed using 8086 microprocessor kit
23
Dept. of ECE
24
Dept. of ECE
RESULT: Thus division of a two 16 bit numbers is performed and results are observed using 8086 microprocessor kit
25
Dept. of ECE
BACK:
26
Dept. of ECE
RESULT: Thus factorial of a given number is performed and results are observed using 8086 microprocessor kit.
27
Dept. of ECE
7. TASM PROGRAMMES
ARITHMETIC OPERATION
1. MULTI BYTE ADDITION
AIM: To write a program to add two multi byte numbers. APPARATUS: Computer system installed with TASM. ALGORITHM:
Step1: initialize the data segment. Step2: load cx with counter Step3: load the si first number Step4: load the first byte of num1 (si) into al Step5: add the first byte of num1 (si) and first byte of num2 (si) with carry Step6: move the result into num3 (si) Step7: decrement si Step8: decrement count Step9: jump if not zero to step4 Step10: end of the program
PROGRAM:
ASSUME CS: CODE, DS: DATA DATA SEGMENT NUM1 DB 11H,22H,33H,44H,55H,66H,77H,88H NUM2 DB 11H,22H,33H,44H,55H,66H,77H,88H NUM3 DB ? DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX CLC MOV CL, 08 MOV SI, 0007 BACK: MOV AL, NUM1 [SI] ADC AL, NUM2 [SI] MOV NUM3 [SI], AL V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 28
Dept. of ECE
OUTPUT:
MEMORY LOCATIONS: Input: DS: 0000h:11H 0001h: 22H 0002h: 33H 0003h: 44h 0004h: 55H 0005H: 66H 0006h: 77H 0007h: 88H 0008h: 11H 0009h: 22H 000Ah:33H 000Bh:44H 000Ch:55H 000DH:66H 000Eh:77H 000Fh:88H 0015H: CCH 0016h: EFH 0017h: 10H
OUTPUT: DS: 0010h: 22H 0011h: 44H 0012h: 66H 0013h: 88H 0014h: AAH
Memory Locations: Input: ds: 0000h: V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE
0001h: 29
Dept. of ECE
0002h: 0003h: 0004h: 0005H: 0006h: 0007h: 0008h: OUTPUT :DS:0010h: 0011h: 0012h: 0013h:
0009h: 000Ah: 000Bh: 000Ch: 000DH: 000Eh: 000Fh: 0014h: 0015H: 0016h: 0017H:
30
Dept. of ECE
PROGRAM: ASSUME CS:CODE,DS:DATA DATA SEGMENT NUM1 DB 88H,77H,66H,55H,44H,33H,22H,11H NUM2 DB 11H,22H,33H,44H,11H,22H,11H,11H NUM3 DB ? DATA ENDS CODE SEGMENT START: MOV AX,DATA MOV DS,AX CLC MOV CL,08 MOV SI,0007 BACK: MOV AL,NUM1[SI] SBB AL,NUM2[SI] MOV NUM3[SI],AL DEC SI DEC CL V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 31
Dept. of ECE
0000h: 0001h: 0002h: 0003h: 0004h: 0005: 0006h: 0007h: OUTPUT:DS: 0010h: 0011h: 0012h: 0013h: 0014h: 0015h: 0016h: 0017h: OBSERVATION: (practical): INPUT: NUM1= NUM2= OUTPUT: RES=
Input: DS:
32
Dept. of ECE
Memory Locations: INPUT: DS: 0000h: 0001h: 0002h: 0003h: 0004h: 0005H: 0006h: 0007h: 0008h: 0009h: 000Ah: 000Bh: 000Ch: 000DH: 000Eh: 000Fh:
OUTPUT: DS: 0010h: 0011h: 0012h: 0013h: 0014h: 0015H: 0016h: 0017h: RESULT: Multi byte subtraction is performed and results are observed using TASM
EXERCISE: 1. Why is subtract with carry instruction is used in the loop? 2. What is the purpose served by BX register? 3. Why subtraction is done with AL register why not with AX? 4. What is the other instruction which can be used instead of MOV DI, offset NUM2?
33
Dept. of ECE
34
Dept. of ECE
RES=08h RES1=00h MEMORY LOCATIONS: INPUT: DS: 0000h: 04H 0001h: 02h OUTPUT: DS: 0002h: 08H 0003h: 00h OBSERVATION: INPUT: NUM1= NUM2= RES= RES1=
OUTPUT:
OUTPUT:
MEMORY LOCATIONS: INPUT: DS: 0000h: 0001h: OUTPUT: DS: 0002h: 0003h: RESULT: 8-bit unsigned multiplication is performed and results are observed using TASM. EXERCISE: 1. AL and BL are used for multiplying why not AX & BX? 2. Instead of using MOV BL is it not possible to MUL num2? 3. What is the instruction used for signed multiplication? V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 35
Dept. of ECE
36
Dept. of ECE
OUTPUT:
RESULT: 8-bit signed multiplication is performed and results are observed using TASM. VIVA QUESTIONS: 1. What is the difference between IMUL and MUL? 2. What is the use of instruction CBW? 3. What is the use of instruction CWD?
37
Dept. of ECE
AIM: To write a program to multiply two 16-bit unsigned numbers. APPARATUS: ALGORITHM: STEP1: Initialize the data segment STEP2: Load the AX with NUM1 STEP3: Load the BX with NUM2 STEP4: Multiply AX & BX(Unsigned) STEP5: Store the result in AX and DX STEP6: End of the program PROGRAM: ASSUME CS: CODE, DS: DATA DATA SEGMENT NUM1 DW 0004H NUM2 DW 0002H RESULT DW 00 RESULT1 DW 00 DATA ENDS CODE SEGMENT START: MOV AX,DATA MOV DS,AX MOV AX,NUM1 MOV BX,NUM2 MUL BX MOV RESULT,AX MOV RESULT1,DX INT 3 CODE ENDS END START Computer system installed with TASM
38
Dept. of ECE
MEMORY LOCATIONS: INPUT: DS: 0000h:04H 0001h:00h 0002h:02H 0003h:00h OUTPUT: DS: 0004:08h 0005:00h 0006:00h 0007:00h OBSERVATION: (PRACTICAL): INPUT: OUTPUT: NUM1= NUM2= RES= RES1=
MEMORY LOCATIONS: INPUT: DS: 0000h: 0001h: 0002h: 0003h: OUTPUT: DS: 0004h: 0005h: 0006h: 0007h: RESULT: 16-bit Multiplication is performed and results are observed using TASM.
39
Dept. of ECE
EXERCISE: 1. Why AL & BL are not used in this program? 2. If result exceeds 32 bit, where is it stored?
40
Dept. of ECE
04H 02H ? ?
41
Dept. of ECE
MEMORY LOCATIONS: INPUT: DS: 0000h: 04H 0001h: 02h OUTPUT: DS: 0002:02h 0003:00h OBSERVATION: (PRACTICAL): INPUT: NUM1= NUM2= OUTPUT: RES= RES1= MEMORY LOCATIONS: INPUT: DS: 0000h: 0001h: OUTPUT: DS: 0002: 0003: RESULT: Division of two 8-bit numbers is performed and results are observed using TASM. EXERCISE: 1. Why is the registers DX & AX made zero in the above program? 2. Where is the remainder in 8 bit division? 3. Where is the quotient in 8 bit division? 4. Which interrupt is used when a divide overflow error occurs? V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 42
Dept. of ECE
Dept. of ECE
INPUT: OUTPUT:
RESULT: 8-bit signed division is performed and results are observed using TASM.
EXERCISE: 1. What is the purpose of XOR AX,AX? 2. What is the difference between IDIV and DIV? 3. What is the use of instruction CBW & CWD?
44
Dept. of ECE
0004H 0002H ? ?
45
Dept. of ECE
OBSERVATION: (practical): INPUT: NUM1= NUM2= OUTPUT: RES= RES1= RESULT: 16-bit division is performed and results are observed using TASM.
EXERCISE: 1. What happens if DX register contains a nonzero value before DIV instruction? 2. What is the instruction used for signed division? 3. In the above program instead of DIV BX is it possible to use DIV num2?
46
Dept. of ECE
Dept. of ECE
OBSERVATIONS: Input:
Input:
Output:
Output:
RESULT: Thus largest number from given numbers are found and results are observed using trainer kit.
48
Dept. of ECE
Dept. of ECE
OR AL,30H OR AH,30H MOV RES,AX INT 03H CODE ENDS END START OBSERVATIONS:(Theoretical) INPUT: NUM1=36H NUM2=32H RES=38H 30H
OUTPUT:
OBSERVATION: (practical) INPUT: NUM1= NUM2= OUTPUT: RES= RESULT: ASCII addition is performed and results are observed using TASM.
EXERCISE: 1. What is the purpose of ASCII addition? 2. What is the instruction used for ASCII addition? 3. Why do we make use of instruction ORL AX, 3030H ? 4. Why is AAA after addition?
50
Dept. of ECE
Dept. of ECE
OR AH,30H MOV RES,AX INT 03H CODE ENDS END START OBSERVATIONS:(Theoretical) INPUT: NUM1=36H NUM2=32H RES=34H 30H
OUTPUT:
MEMORY LOCATIONS: Input: ds: 0000h:36H 0001h:32H output: ds: 0002:34H 0003:30H
OBSERVATION: (practical) INPUT: NUM1= NUM2= OUTPUT: RES= MEMORY LOCATIONS: Input: ds: 0000h: 0001h: output: ds: 0002h: 0003h:
RESULT: ASCII subtraction is performed and results are observed using TASM.
52
Dept. of ECE
EXERCISE: 1. What is the purpose of ASCII subtraction? 2. What is the instruction used for ASCII subtraction? 3. Why do we make use of instruction ORL AX,3030H ? 4. Why is AAS after addition?
53
Dept. of ECE
Dept. of ECE
OUTPUT:
AX=FFFFH BX=0002H
RESULT: Checking whether a given 16-bit number is even or odd is performed and results are observed using Tasm.
55
Dept. of ECE
Dept. of ECE
OUTPUT:
AX=FFFFH BX=0000H
RESULT: Checking whether a given 16-bit number is positive or negative is performed and results are observed using TASM.
EXERCISE: 1. How can we differentiate between a positive number and a negative number?
57
Dept. of ECE
3. SORTING (ASCENDING)
AIM: To write a program to sort a given list of numbers in ascending order. APPARATUS: ALGORITHM: STEP1: Initialize the data segment STEP2: Initialize the count in DX Register STEP3: Load DX with count STEP4: move DX into the CX Register STEP5: Load the SI with first byte of List STEP6:Move the content of SI into AX register STEP7:Compare AXwith second byte of SI STEP8: Jump if Less to the step11 STEP9:Exchage AX and second byte of SI STEP10: Exchage AX and first byte of SI STEP11:Add SI with 02 STEP12:continue the loop until to get the result and go to the step7 STEP13:Decrement DX STEP14:Jump if non zero to the step 4 STEP15:END of the program PROGRAM: ASSUME CS:CODE,DS:DATA DATA SEGMENT LIST DW 53H,25H,89H,02H COUNT EQU 04H DATA ENDS CODE SEGMENT START:MOV AX,DATA MOV DS,AX MOV DX,COUNT MOV CX,DX MOV SI,OFFSET LIST MOV AX,[SI] CMP AX,[SI+02] JL NEXT XCHG [SI+02],AX 58 Computer system installed with TASM
AGAIN0: AGAIN1:
Dept. of ECE
XCHG [SI],AX NEXT: ADD SI,02H LOOP AGAIN1 DEC DX JNZ AGAIN0 MOV AH,4CH INT 03 CODE END END START OBSERVATIONS:(Theoritical) INPUT: LIST=53H,25H,89H,02H
OUTPUT: LIST=02H,25H,53H,89H MEMORY LOCATIONS: OUTPUT:DS: 0000H:00h 0001H:00h 0002H:02h 0003H:00h 0004H:25h 0005H:00h 0006H:53h 0007H:00h 0008H:89h OBSERVATIONS:(practical) INPUT: LIST=
OUTPUT: LIST= MEMORY LOCATIONS: OUTPUT:DS: 0000H: 0001H: 0002H: 0003H: 0004H: 0005H: 0006H: 0007H: 0008H: V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 59
Dept. of ECE
RESULT: Sorting of a given list of numbers is performed and results are observed using TASM.
EXERCISE: 1. What is the sorting technique used in above program? 2. Are there any other ways to sort a list?
60
Dept. of ECE
4. SORTING (DESCENDING)
AIM: To write a program to sort a given list of numbers in descending order. APPARATUS: ALGORITHM: STEP1: Initialize the data segment STEP2: Initialize the count in DX Register STEP3: Load DX with count STEP4: move DX into the CX Register STEP5: Load the SI with first byte of List STEP6:Move the content of SI into AX register STEP7:Compare AXwith second byte of SI STEP8: Jump if Greater to the step11 STEP9:Exchage AX and second byte of SI STEP10: Exchage AX and first byte of SI STEP11:Add SI with 02 STEP12:continue the loop until to get the result and go to the step7 STEP13:Decrement DX STEP14:Jump if non zero to the step 4 STEP15:END of the program PROGRAM: ASSUME CS:CODE,DS:DATA DATA SEGMENT LIST DW 53H,25H,89H,02H COUNT EQU 04H DATA ENDS CODE SEGMENT START: MOV AX,DATA MOV DS,AX MOV DX,COUNT AGAIN0: MOV CX,DX MOV SI,OFFSET LIST AGAIN1: MOV AX,[SI] CMP AX,[SI+02] JG NEXT V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 61 Computer system installed with TASM
Dept. of ECE
XCHG [SI+02],AX XCHG [SI],AX NEXT:ADD SI,02H LOOP AGAIN1 DEC DX JNZ AGAIN0 MOV AH,4CH INT 03 CODE END END START OBSERVATIONS:(Theoritical) INPUT: LIST=53H,25H,89H,02H
OUTPUT: LIST=89H,53H,25H,02H MEMORY LOCATIONS: OUTPUT:DS: 0000H:00h 0001H:00h 0002H:89h 0003H:00h 0004H:53h 0005H:00h 0006H:25h 0007H:00h 0008H:02h OBSERVATIONS:(practical) INPUT: LIST=
OUTPUT: LIST= MEMORY LOCATIONS: OUTPUT:DS: 0000H: 0001H: 0002H: 0003H: 0004H: 0005H: 0006H: V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 62
Dept. of ECE
0007H: 0008H: RESULT: Sorting of a given list of numbers is performed and results are observed using TASM. EXERCISE: 1. What is the sorting technique used in above program? 2. Are there any other ways to sort a list?
63
Dept. of ECE
Dept. of ECE
OUTPUT: UBCDOP=06H 05H MEMORY LOCATIONS: Input: ds: 0000h:56h output: ds: 0001h:06h 0002h:05h OBSERVATIONS:(practical) INPUT: OUTPUT: BCDIP= UBCDOP=
RESULT: Conversion of packed BCD to unpacked BCD is performed and results are observed using TASM.
EXERCISE: 1. What is the purpose of the instruction ROR AL, CL? 2. What is the purpose of the instruction AND AL, 0FH & AND AL,0F0H in the program.? 3. What is the expansion of UPBCD? V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 65
Dept. of ECE
4. What is the use of DAA instruction? 5. What is the reason for packing unpacked BCD? 6. What is common between unpacked BCD and ASCII?
66
Dept. of ECE
04H
67
Dept. of ECE
MEMORY LOCATIONS: Input: ds: 0000h:04h output: ds: 0001h:34H OBSERVATIONS:(practical) INPUT: OUTPUT: BCDIP= ASCOP=
RESULT: Conversion of BCD to ASCII is performed and results are observed using TASM.
EXERCISE: 1. What is the difference between adding 30h and OR 30H to a BCD number to conversion to ASCII? 2. Why unpacking is necessary during the conversion? 3. What is the ASCII character for symbol A? 4. What is the ASCII character for symbol zero 0?
68
Dept. of ECE
Dept. of ECE
Inc si Jmp Up Mov String2[si],al Up1: Int 03 Code ends End start
OBSERVATIONS:(Theoretical) INPUT: STRING=KAKINADA OUTPUT: K=6BH A=61H K=6BH I=69H N=6EH A=61H D=64H A=61H MEMORY LOCATIONS: output: ds: 0000h:6BH 0001h:61H 0002h:6BH 0003h:69H 0004h:6EH 0005h:61H 0006h:64H 0007h:61H
MEMORY LOCATIONS: output: ds: 0000h: 0001h: V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 70
Dept. of ECE
0002h: 0003h: 0004h: 0005h: 0006h: 0007h: RESULT: Length of a string is performed and results are observed using TASM. EXERCISE: 1. What is the operation performed by the instruction cmp al,$ ? 2. What is function 09h / int 21h performed? 3. Why SI is not been incremented is the program?
71
Dept. of ECE
2 BLOCK TRANSFER
AIM: To write a program to transfer a block of characters from one place to another place using string instructions. APPARATUS: ALGORITHM: STEP1: Initialize the data segment and ES STEP2: Load SI with first number (num1) STEP3: Load DI with first number (num2) STEP4: Load the count into CL STEP5: clear the direction flag and transfer the string of bytes into Respective memory locations STEP6: End of the program PROGRAM: ASSUME CS:CODE, DS:DATA DATA SEGMENT NUM1 DB 11H,22H,33H,44H,55H,66H,77H,88H NUM2 DB 01H,02H,03H,04H,05H,06H,07H,08H COUNT EQU 08H DATA ENDS CODE SEGMENT START: MOV AX, DATA MOV DS, AX MOV ES, AX MOV SI, OFFSET NUM1 MOV DI, OFFSET NUM2 MOV CL, COUNT CLD REP MOVSW INT 03H CODE ENDS END START Computer system installed with TASM
72
Dept. of ECE
OBSERVATIONS:(Theoretical) INPUT: NUM1:11H,22H,33H,44H,55H,66H,77H,88H NUM2:01H,02H,03H,04H,05H,06H,07H,08H OUTPUT: NUM1: 11H,22H,33H,44H,55H,66H,77H,88H MEMORY LOCATIONS: OUTPUT: DS: 0000h:11H 0001h:22H 0002h:33H 0003h:44H 0004h:55H 0005h:66H 0006h:77H 0007h:88H
OBSERVATIONS:(PRACTICAL) INPUT: NUM1: NUM2: OUTPUT: NUM1: MEMORY LOCATIONS: OUTPUT: DS: 0000h: 0001h: 0002h: 0003h: 0004h: 0005h: 0006h: 0007h: RESULT: Block transfer is performed and results are observed using TASM.
73
Dept. of ECE
EXERCISE: 1. If the DF=1, will the SI and DI register decremented? 2. The destination memory is pointed by which register combination? 3. The source is pointed to by which register combination?
74
Dept. of ECE
3 STRING COMPARISION
AIM: To write a program to Compare the two strings. APPARATUS: ALGORITHM: STEP1: Initialize the data segment and ES STEP2: Load CL with first count (string1) STEP3: Load CL with first count (string2) STEP4: Compare CL &CH (string1 & string2) STEP5: Jump if non zero to the step18 STEP6:load the first string character into AL STEP7:load the second string character into BL STEP8: Jump if non zero to the step18 STEP9:load the first string character into AL STEP10:load the second string character into BL STEP11:Compare the strings STEP12: Jump if non zero to the step18 STEP13:Increment SI STEP14:Decrement CL &CH STEP15: Jump if non zero to the step6 STEP17:load the AX with 0000h STEP18: Jump to the step20 STEP19:load the AX with1111h STEP20: End of the program PROGRAM: Assume cs:code, ds:data Data segment Count1 db 04h Count2 db 04h String1 db JNTU String2 db JNTU Data ends Code segment Start: Mov ax,data Mov ds,ax V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 75 Computer system installed with TASM
Dept. of ECE
Mov cl,count1 Mov ch,count2 Cmp ch,cl Jnz Below Mov si,0000h Up: Mov al,string1[si] Mov bl,string2[si] Cmp al,bl Jnz Below Inc si Dec cl Dec ch Jnz Up Jmp Below1 Below: Mov ax,0000h Jmp exit Below1: Mov ax,1111h Exit: Int 03 Code ends End start OBSERVATIONS:(Theoretical) INPUT: STRING1 =JNTU STRING2=KAKINADA OUTPUT: AX:1111H MEMORY LOCATIONS: OUTPUT: DS: 0000h:04H 0001h:04H 0002h:4AH:J 0003h:4EH:N 0004h:54H:T 0005h:55H:U 0006h:4BH:K 0007h:41H:A 0008h:4BH:K 0009h:49H:I 000Ah:4EH:N 000Bh:41H:A V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 76
Dept. of ECE
MEMORY LOCATIONS: OUTPUT: DS: 0000h: 0001h: 0002h: 0003h: 0004h: 0005h: 0006h: 0007h: 0008h:
RESULT: compare the two strings are performed and results are observed using TASM.
77
Dept. of ECE
4 STRING REVERSAL
AIM: To write a program to reverse a given string. APPARATUS: ALGORITHM: STEP1: Initialize the data segment and ES STEP2: Initialize SI &DI STEP3: Load BX with count STEP4: move the BL into DL STEP5: Jump if non zero to the step18 STEP6:load the first string character into AL STEP7:load the second string character into BL STEP8: Jump if non zero to the step18 STEP9:load the first string character into AL STEP10:load the second string character into BL PROGRAM: Assume cs:code, ds:data Data segment Count dw 0003h String1 db VKR String2 db ? Data ends Code segment Start : Mov ax,data Mov ds,ax Mov si,0000h Mov di,0000h Mov bx,count Mov cl,04h Up: Mov al,String1[si+bx] Mov String2[di],al Inc di Dec bx Jnz Up Int 03 V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 78 Computer system installed with TASM
Dept. of ECE
MEMORY LOCATIONS: INPUT:DS: 0000H:K=6BH 0001H:A=61H 0002H:K=6BH 0003H:I=69H 0004H:N=6EH 0005H:A=61H 0006H:D=64H 0007H:A=61H OBSERVATIONS:(practical) INPUT: OUTPUT: STRING1= STRING2=
MEMORY LOCATIONS: INPUT:DS: 0000H 0001H 0002H 0003H OUTPUT:DS: 0008H 0009H 000AH 000BH 000CH RESULT:
= = = = = = = = =
= = = =
String reversal is performed and results are observed using TASM. V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 79
Dept. of ECE
EXERCISE: 1. Why BX register is added with 5? 2. Why MOVS instruction is not used? 3. What is the function of LODS and STOS instructions?
80
Dept. of ECE
5. STRING INSERTION
AIM: To write a program to insert a word in the given sentence. APPARATUS: ALGORITHM: STEP1: Initialize the data segment STEP2: Initialize the SI Register with 0000 STEP3: Load DL with Location STEP4: Initialize the DI Register with 0000 STEP5: Move the content of LEN into the CL register STEP6:Compare DX with SI Register STEP7: Jump if Equal to the step18 STEP8: Move the content of String1 into the AL register STEP9:Move the content of AL into the String2 of DI Register STEP10: Decrement CL and increment SI,DI STEP11:Jump to STEP6 STEP12:Move the content of ELEMENT into the AL register STEP13:Move the AL into DI STEP14:Increment DI STEP15:Move the SI into AL and AL into DL STEP16: Increment SI STEP17: Continue the loop until to get result STEP18:End of the program PROGRAM: Assume cs:code, ds:data Data segment String1 db GUDVADA String2 db ? Element db I Len db 08h Location db 03h Data ends Code segment Start: Mov ax,data 81 Computer system installed with TASM
Dept. of ECE
Mov ds,ax Mov si,0000h Mov dl,Location Mov di,0000h Mov cl,len Up: Cmp dx,si Je down Mov al,string1[si] Mov string2[di],al Dec cl Inc si Inc di Jmp Up Down: Mov al,element Mov string2[di],al Up1: inc di Mov al,string1[si] Mov string2[di],al Inc si Loop Up1 Int 03 Code ends End start OBSERVATIONS:(Theoretical) INPUT: STRING1=RAJASKAR ELEMENT=E STRING2=RAJASEKAR
OUTPUT:
MEMORY LOCATIONS: INPUT:DS: 0000H:R=52H 0001H:A=41H 0002H:J=4AH 0003H:A=41H 0004H:S=53H 0005H:K=4BH 0006H:A=41H 0007H:R=52H V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 82
Dept. of ECE
OUTPUT:DS: 0008H:R=52H 0009H:A=41H 000AH:J=4AH 000BH:A=41H 000CH:S=53H 000DH:E=45H 000EH:K=4BH 000FH:A=41H 0010H:R=52H
OBSERVATIONS:(practical)
INPUT:
OUTPUT:
MEMORY LOCATIONS: INPUT:DS: 0000H 0001H 0002H 0003H 0004H 0005H 0006H 0007H OUTPUT:DS: 0008H 0009H 000AH 000BH 000CH 000DH 000EH 000FH
= = = = = = = = = = = = = = = =
83
Dept. of ECE
RESULT: String insertion is performed and results are observed using TASM.
EXERCISE: 1. Why register DI is loaded with 5? 2. What is the function of rep movsb? 3. What is the purpose of mov ah,01h / int 21h?
84
Dept. of ECE
6. STRING DELETION
AIM: To delete a word from the given sentence. APPARATUS: ALGORITHM: STEP1: Initialize the data segment STEP2: Initialize the SI Register with 0000 STEP3: Load CL with counter STEP4: Load DH with counter 1 STEP5: Move the content of String1 into the AL register STEP6: Compare AL and DL STEP7 Jump on zero to step15 STEP8:Increment CH and SI STEP9: Compare CL and CH STEP10:Jump if non zero to step5 STEP11:Subtract DH and CL STEP12:Move the SI into AL and AL into DL STEP13: Increment SI and decrement DH STEP14:Jump if non zero to step12 STEP15:End of the program PROGRAM: Assume cs:code, ds:data Data segment String1 db GUDIVADA String2 db ? Count1 db 04h Data ends Code segment Start: Mov ax,data Mov ds,ax Mov si,0000h Mov ch,00h Mov cl,count1 Mov dh,count1 85 Computer system installed with TASM
Dept. of ECE
Mov dl,00h Up1: Mov al,string1[si] Cmp al,dl Jz Below Inc ch Inc si Cmp cl,ch Jnz Up1 Sub dh,cl Up2: Mov al,string1[si] Mov string2[si],al Inc si Dec ch Jnz Up2 Below: int 03h Code ends End start
MEMORY LOCATIONS: INPUT:DS: 0000H:K=4BH 0001H:A=41H 0002H:K=4BH 0003H:I=49H 0004H:N=4EH 0005H:A=41H 0006H:D=44H 0007H:A=41H
Dept. of ECE
0010H:D=44H 0011H:A=41H
MEMORY LOCATIONS: INPUT:DS: 0000H: 0001H: 0002H: 0003H: 0004H: 0005H: 0006H: 0007H:
RESULT: String deletion is performed and results are observed using TASM. EXERCISE: 1. What is the purpose of string length? 2. What does equ stands for? 3. What is the purpose of label start after the end directive?
87
Dept. of ECE
AIM: To write a program to read the keyboard with echo. APPARATUS: ALGORITHM: STEP1: Initialize the data segment STEP2: Move 01 into AL STEP3: Initialize DOS STEP4: Move AL into address STEP5: End of the program PROGRAM: DATA SEGMENT CHAR DB 0 DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA START: MOV AX,DATA MOV DS,AX MOV AH,01H INT 21H MOV CHAR, AL INT 3 CODE ENDS END START OBSERVATIONS: INPUT: N Computer system installed with TASM
OUTPUT:N
88
Dept. of ECE
RESULT: Reading a keyboard is performed and results are observed using TASM. EXERCISE: Write a brief note on DOS interrupts. 2. What does AH register hold when INT 21H is called?
1.
89
Dept. of ECE
AIM: To write a program to read the keyboard without echo. APPARATUS: ALGORITHM: STEP1: Initialize the data segment STEP2: Move 08 into AL STEP3: Initialize DOS STEP4: Move AL into address STEP5: End of the program PROGRAM: DATA SEGMENT CHAR DB 0 DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA START: MOV AX,DATA MOV DS,AX MOV AH,08H INT 21H MOV CHAR, AL INT 3 CODE ENDS END START OBSERVATIONS: INPUT: OUTPUT: RESULT: Reading a keyboard is performed and results are observed using TASM. V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 90 Computer system installed with TASM
Dept. of ECE
EXERCISE: Write a brief note on DOS interrupts. 2. What does AH register hold when INT 21H is called?
1.
91
Dept. of ECE
9. DISPLAYING A CHARACTER
AIM: To write a program to displaying a given string. APPARATUS: ALGORITHM: STEP1: Initialize the data segment STEP2: Move 08 into AL STEP3: Initialize DOS STEP4: Move AL into address STEP5: End of the program PROGRAM: DATA SEGMENT CHAR DB DATA ENDS Computer system installed with TASM
CODE SEGMENT ASSUME CS: CODE, DS: DATA START: MOV AX, DATA MOV DS, AX MOV AH, 02H MOV DL,CHAR INT 21H MOV AX, 4C00H INT 21H CODE ENDS END START OBSERVATIONS: INPUT: OUTPUT: RESULT:
92
Dept. of ECE
Displaying a character on screen is performed and results are observed using TASM. EXERCISE: 1. Write a brief note on DOS interrupts. 2. What does AH register hold when INT 21H is called?
93
Dept. of ECE
RESULT: Displaying a string on screen is performed and results are observed using TASM. V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 94
Dept. of ECE
EXERCISE: 1. Write a brief note on DOS interrupts. 2. What does AH register hold when INT 21H is called?
95
Dept. of ECE
96
Dept. of ECE
MOV SP,3000H //INITIALISE STACK POINTER CALL FAR 0FE00:0031H //NEWLINE MOV DX,0FFE6H //INITIALISE 8255 AS FOLLOWS MOV AL,81H //PORT A = OUTPUT OUT DX,AL //PORT C = INPUT JMP SHORT START TEST: DB 0DH,20H,'CONVERTING... ', 00H MES: DB 0AH,0DH,20H, 'DIGITAL VALUE = ',00H START: MOV DX,0FFE4H IN AL,DX CALL DELAY CALL DELAY AND AL,02H JZ START //wait for start of conversion(SOC)
97
Dept. of ECE
MOV AX,0FFH PUSH AX CONT: MOV DX,0FFE4H //check for SOC IN AL,DX CALL DELAY AND AL,02H JNZ START //If true start again POP AX //else continue MOV DX,0FFE0H INC AL //increment count and OUT DX,AL //output to port PUSH AX PUSH DX LEA DX,TEST //display 'converting...' MOV AX,DX POP DX CALL FAR 0FE00:0013H CALL DELAY MOV DX,0FFE4H //read comparator output IN AL,DX AND AL,00000001B JNZ CONT //if PC0=1,continue else LEA DX,MES //conversion is over MOV AX,DX CALL FAR 0FE00:0013H //display message POP AX CALL FAR 0FE00:0052H //DISPLAY OUTPUT CALL FAR 0FE00:0031H JMP SHORT START DELAY: MOV CX,8000H HERE: LOOP HERE RET END //delay routine
98
Dept. of ECE
RESULT: 8086 Interfacing with 8255 is done and results are observed.
99
Dept. of ECE
.8086 .MODEL TINY .STACK 32 .DATA .CODE ORG 2000H START: MOV AX,CS MOV DS,AX MOV AL,10H // ENCODED SCAN-8CHAR 8 BIT LEFT ENTRY MOV DX,CMDREG OUT DX,AL MOV AL,090H //WRITE RAM AUTO INCREMENT OUT DX,AL MOV CX,08 CLEAR:MOV AL,00 MOV DX,DATAREG OUT DX,AL LOOP CLEAR BACK: MOV DX,CMDREG IN AL,DX // READ THE COMMAND R4EGISTER TO GET THE 8279 STATUS
100
Dept. of ECE
AND AL,07 // NUMBER OF KEYS PRESSED IS IN THE LOWER 3 BITS MASK //THESE AND CHECK IF NOT ZERO. IF ZERO NO KEY PRESSED JZ BACK MOV BX,OFFSET SSCHARLUT MOV AL,040H // READ THE FIRST RAM ADDRESS OF FIFO OUT DX,AL MOV DX,DATAREG // IN AL, DX AND AL,01FH XLAT // CONVERT THE KEY READ TO THE SS CODE MOV DX,DATAREG OUT DX,AL // DISPLAY AT THE CURRENT DIGIT POSITION JMP BACK SSCHARLUT: SS0 DB 3FH //0 SS1 DB 6H //1 SS2 DB 5BH //2 SS3 DB 4FH //3 SS4 DB 66H //4 SS5 DB 6DH //5 SS6 DB 7DH //6 SS7 DB 07H //7 SS8 DB 7FH SS9 DB 6FH SSA DB 77H SSB DB 7CH SSC DB 39H SSD DB 5EH SSE DB 79H SSF DB 71H END START OBSERVATIONS: INPUT:
101
Dept. of ECE
OUTPUT: RESULT: 8086 Interfacing with 8279 is done and results are observed.
102
Dept. of ECE
103
Dept. of ECE
RESULT: 8086 Interfacing with 8279 is done and results are observed.
104
Dept. of ECE
4. 8251 USART
AIM: To interface USART (Universal Synchronous Asynchronous Receiver Transmitter) with 8086 microprocessor. APPARATUS: 1 2 3 PROGRAM: TRANSMITTER END: ORG 1000H MOV AL,36H OUT 0CEH, AL MOV AL,10H OUT 0C8H, AL MOV AL,00H OUT 0C8H, AL MOV AL,4EH OUT 0C2H, AL MOV AL,37H OUT 0C2H, AL LOOP1:IN AL,0C2H AND AL,04H JZ LOOP1 MOV AL,41H OUT 0C0H,AL INT 02H RECEIVER END: ORG 1200H MOV AL,36H OUT 0CEH, AL MOV AL,10H OUT 0C8H, AL MOV AL,00H V.K.R, V.N.B & A.G.K ENGINEERING COLLEGE 105 8086 TRAINER KIT 8251 STUDY CARD ADAPTER, KEYBOARD, CABLES, ETC
Dept. of ECE
OUT 0C8H, AL MOV AL,4EH OUT 0C2H, AL MOV AL,37H OUT 0C2H, AL LOOP2:IN AL,0C2H AND AL,04H JZ LOOP2 IN AL,0C0H MOV BX,I500H MOV [BX],AL INT 02H
RESULT: 8086 Interfacing with 8279 is done and results are observed.
106
Dept. of ECE
107
Dept. of ECE
Dept. of ECE
35. In 8259 if IR3, IR6, IR7 are activated, which interrupt has the highest priority? 36. Which register in 8259 is used to disable interrupt requests? 37. Which ports are used in BSR mode of 8255? 38. Which port provides hand shaking signals in Mode1 & Mode2 of 8255? 39. What is the IC used for DMA transfer? 40. How many peripherals can be connected to 8237 at any point of time? 41. For bidirectional data transfer, 8255 is operated in which mode? 42. DMA will send a request signal to which pin of 8086? 43. Which instruction is used to return from the interrupt service procedure? 44. What are the ICs MC 1488 and MC 1489? 45. When accessing a memory location shared with a coprocessor, the signal that prevents the coprocessor from accessing that location is? 46. There are two no. of 2Kx8 memory chips. How to obtain 4Kx8 memory? 47. When the processor has 32 address lines, how much memory can be interfaced to that processor? 48. Whether Stepper Motor is an AC Motor or DC Motor? 49. Give any application of Stepper Motor in our real life? 50. What do you mean by interfacing?
Who has introduced MCS-51 family of microcontrollers? MCS-51 family of microcontrollers contains which ICs? What is the difference between MP and MC? Give any Example of Microcontrollers? Is 8051 an 8-bit controller? Why 8051 is an 8-bit controller? What is the on chip ROM capacity of 8051? What is the on chip RAM capacity of 8051? How many IO ports are available on 8051 on chip? How many timers are available on 8051 on chip? Which version of 8051 doesnt have on chip ROM? Which version of 8051 contains EPROM on chip? 8051 contains which type of ROM? What is the purpose of ROM in 8051? What is the purpose of RAM in 8051? Whether ROM is accessible randomly or not? What is the capacity of on chip EPROM on 8751? Can you connect external program memory to 8051? Can you connect external data memory to 8051? 109
Dept. of ECE
20. What is the capacity of external program memory that can be connected to 8051? 21. What is the capacity of external data memory that can be connected to 8051? 22. How can you access internal program memory? 23. How can you access external program memory? 24. How is it possible to access both internal & external ROM using PC? 25. How can you access internal data memory? 26. How can you access external data memory? 27. Do you require any signal to access external data memory? 28. Do you require any signal to access external program memory? 29. What is the reason behind connecting only 64KB of external program memory? 30. What is the reason behind connecting only 64KB of external data memory? 31. Expand DPTR? 32. Is a DPTR an 8-bit register? 33. Can we access PC as two 8-bit registers? 34. Is there any register in 8086 similar to PC in 8051? 35. Expand SFR? 36. Is PC a special function register? 37. Whether external interrupts are edge triggered or level triggered type? 38. Expand ALE? 39. Expand PSEN? 40. What is the function of PSEN pin? 41. For serial communication the pins of which IO port is used? 42. Which register is used to operate 8051 in different modes? 43. What are the modes of operation of 8051? 44. Whether PCON is a bit addressable SFR? 45. Which port will hold the higher order address information during memory access? 46. Which Io port of 8051 doesnt have dual function? 47. What is the Architecture of 8051? 48. What is stack? 49. What is the function of SP register? 50. The number of clock cycles in one machine cycle of 8051 is?
110
Dept. of ECE
Dept. of ECE
35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50.
IR3. Interrupt Mask Register. Only Port C bits. Port C provides hand shaking signals. 8237 or 8257 Four Mode 2 HOLD pin. IRET. Voltage translators. LOCK By connecting address lines in serial and data lines parallel 232 = 4GB DC Motor Printers, X-Y plotters, Hard disk/Floppy Disk Drives, etc., Interfacing means not only connecting the devices but also communicating between them.
Dept. of ECE
19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50.
Yes 64KB 64KB Program Counter Program Counter Whenever we access external program memory, we use MOVX instruction which distinguish the internal & external ROM. By means of its address in the program instructions. Data Pointer. Yes. We require Logic 0 on External Access pin. No signal is required to access external program memory. Because PC is a 16-bit register, the maximum memory that can be interfaced externally is 216 = 64KB only. DPTR is a 16-bit register// the maximum memory that can be interfaced externally is 216 = 64KB only. Data Pointer DPTR is a 16-bit register, but we can access it as two 8-bit registers DPH & DPL. No, we cant access PC as two 8-bit registers. PC is very similar to IP register in 8086. SFR stands for Special Function register. No, PC is the only register which doesnt come under SFR. They can be programmed as either edge triggered or level triggered. Address Latch Enable PSEN stands for Program Store ENable. PSEN is used to store program in external memory. Port 3 pins are used for serial communication. PCON (Power CONtrol) SFR is used. Power Down Mode and Idle Mode. No. PCON is not bit addressable. Port 2 will hold the higher order address information during memory access. Port 1 pins have no dual functions. The Architecture of 8051is called Harvard Architecture. Stack is an area in internal RAM that is used in conjunction with certain opcodes to store and retrieve data quickly. SP holds an internal RAM address that is called top of the stack. 12 clock cycles.
113