MPMC Lab Manual
MPMC Lab Manual
Dr.RANGARAJAN Dr.SAKUNTHALA
ENGINEERING COLLEGE
(ISO 9001: 2000 Certified Institution & NBA Accredited)
(Owned by VEL Sree Dr.RANGARAJAN Dr. Sakunthala Rangarajan Educational Academy1997)
CS6411/MICROPROCESSOR &
MICROCONTROLLER LAB MANUAL
All the above should be written on the right page of the record.
Neat Circuit Diagram, Name Plate Details / Specifications / Design Details, Tabulations, Graph
The above should be written / drawn on the left page of the record using pencil.
Graphs / figures drawn on sheets should be firmly pasted to the record.
Before writing the record, the student should get the corresponding observations
approved by the faculty in - charge and carry over the marks obtained to the
record.
The record be completed in all respects and submitted in the next class.
SYLLABUS
OUTCOMES:
At the end of the course, the student should be able to:
Write ALP Programs for fixed and Floating Point and Arithmetic
Interface different I/Os with processor
Generate waveforms using Microprocessors Execute Programs in 8051
Explain the difference between simulator and Emulator
INTRODUCTION TO MASM
EDITOR:
An editor is a program, which allows you to create a file containing the assembly language
statements for your program. As you type in your program, the editor stores the ASCII codes for the
letters and numbers in successive RAM locations. When you have typed in all of your programs, you
then save the file on a floppy of hard disk. This file is called source file. The next step is to process
the source file with an assembler. In the MASM /TASM assembler, you should give your source file
name the extension, .ASM
ASSEMBLER:
An assembler program is used to translate the assembly language mnemonics for instructions
to the corresponding binary codes. When you run the assembler, it reads the source file of your
program the disk, where you saved it after editing on the first pass through the source program the
assembler determines the displacement of named data items, the offset of labels and pails this
information in a symbol table. On the second pass through the source program, the assembler
produces the binary code for each instruction and inserts the offset etc that is calculated during the
first pass. The assembler generates two files on floppy or hard disk. The first file called the object file
is given the extension.OBJ. The object file contains the binary codes for the instructions and
information about the addresses of the instructions. The second file generated by the assembler is
called assembler list file. The list file contains your assembly language statements, the binary codes
for each instructions and the offset for each instruction. In MASM/TASM assembler, MASM/TASM
source file name ASM is used to assemble the file. Edit source file name LST is used to view the list
file, which is generated, when you assemble the file.
LINKER:
A linker is a program used to join several object files into one large object file and convert to
an exe file. The linker produces a link file, which contains the binary codes for all the combined
modules. The linker however doesn‟t assign absolute addresses to the program, it assigns is said to be
reloadable because it can be put anywhere in memory to be run. In MASM/TASM, LINK/TLINK
source filename is used to link the file.
DEBUGGER:
A debugger is a program which allows you to load your object code program into system
memory, execute the program and troubleshoot are debug it the debugger allows you to look at the
contents of registers and memory locations after your program runs. It allows you to change the
contents of register and memory locations after your program runs. It allows you to change the
contents of register and memory locations and return the program. A debugger also allows you to set a
break point at any point in the program. If you inset a breakpoint the debugger will run the program
upto the instruction where the breakpoint is set and stop execution. You can then examine register and
memory contents to see whether the results are correct at that point. In MASM/TASM, td filename is
issued to debug the file.
DEBUGGER FUNCTIONS:
COMMAND SYNTAX
Assemble A [address]
Dump D [range]
Go G [=address] [addresses]
Input I port
Quit Q
Register R[register]
Unassembled U [range]
Procedure:
4. In the command window type the directory name after that change the directory to
8086(masm) after that type edit
13
5. After changing directory type edit then you get one window in that window you can
write a program
6. After writing a program click: file->save->exit [again we enter the command window]
14
7. Type : masm filename,,;[This will display the error report]
8. Type: link filename,,; [This will create a list file you can see this inside the
masm(8086)software]
Note:Here we no need to use stack segment so no need to worry about stack error
15
9. Type: debug filename.exe [to create exe file]
16
11. Type: WCS: 1000 [writing code segment]
17
12. Type: g =1000 [to execute a program]
18
14. Type: e 1200 [see output in corresponding address] use space bar to see next output value
19
16. Downloading procedure
20
17. Press f1 key and set the port settings
19. Now in micro 86 kit select receiving mode (i.e.) type Si 1000(starting address) then press
enter key. Then the kit is ready to receive data and press any in the host to start transmission.
During transmission the message display as, transmission progress.
21
Ex. No: 1 ARITHMETIC OPERATIONS
AIM:
To write and execute an assembly language program for add, subtract, multiply and divide
two 16 bit unsigned numbers in 8086 kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Load the First Data in AX-register.
2. Load the First Data in BX-register.
2. Add the two data and get the sum in AX-register.
3. Store the sum in memory location.
4. Stop the program.
PROGRAM:
i) By Using Masm: CODE
SEGMENT
ASSUME CS: CODE, DS: CODE
ORG 1000H
MOV AX, 1234H
MOV BX,
1234H ADD AX,
BX MOV SI,
1200H MOV
[SI], AX MOV
AH, 4CH INT
21H
CODE END
END
INPUT OUTPUT
Register Data Address Data
AX 1234H 1200H 68
BX 1234H 1201H 24
16-BIT SUBTRACTION:
ALGORITHM:
1. Load the First Data in AX-register.
2. Load the First Data in BX-register.
3. Subtract the content of BX-reg from AX-register.
4. Store the result in memory location.
5. Stop the program.
PROGRAM:
i) BY USING MASM:
CODE SEGMENT
ASSUME CS: CODE, DS: CODE
ORG 1000H
MOV AX, 0FFFFH
MOV BX,
0EEEEH SUB AX,
BX MOV SI,
1200H MOV [SI],
AX MOV AH,
4CH INT 21H
CODE
ENDS END
INPUT OUTPUT
Register Data Address Data
AX FFFFH 1200H 11
BX EEEEH 1201H 11
16-BIT
MULTIPLICATION
ALGORITHM:
PROGRAM:
i) By using MASM: CODE
SEGMENT
ASSUME CS: CODE, DS: CODE
ORG 1000H
MOV AX, 4444H
MOV BX,
4444H MUL BX
MOV SI, 1200H
MOV [SI], DX
MOV SI, 1202H
MOV [SI], AX
MOV AH,
4CH INT 21H
CODE ENDS
END
1000 C7,C0, 4444 MOV AX,4444H Load AX-register with 1st data
1004 C7, C3, 4444 MOV BX,4444H Load BX-register with 2nd data
1008 F7, E3 MUL BX Multiply the contents of AX with
BX-register
100a C7, C6, MOV SI,1200H Assign SI-reg to 1200H
00,12
100e 89, 14 MOV [SI],DX Store the result
INPUT OUTPUT
Register Data Address Data
AX 4444H 1200H 34
BX 4444H 1201H 12
1202H 10
1203H 32
ALGORITHM:
1. Load the First Data in AX-register.
2. Load the First Data in BX-register.
3. Subtract the content of BX-reg from AX-register.
4. Store the result in memory location.
5. Stop the program.
PROGRAM:
i) By using MASM:
CODE SEGMENT
ASSUME CS: CODE, DS: CODE
ORG 1000H
MOV DX, 0000H
MOV AX, 8888H
MOV CX, 4444H
DIV CX
MOV SI, 1200H
MOV [SI], AX
MOV SI, 1202H
MOV [SI], DX
MOV AH, 4CH
INT 21H
CODE ENDS
END
1008 C7, C1,44,44 MOV CX, 4444H Load CX-register with Divisor
INPUT OUTPUT
Register Data Address Data
DX 0000H 1200H 00(quotient)
AX 8888H 1202H 02(quotient)
CX 4444H 1203H 00(remainder)
1204H 00(remainder)
RESULT:
Thus an assembly language program for add, subtract, multiply and divide two 16 bit
unsigned numbers was executed using MASM and 8086 kit.
Ex. No: 1B LOGICAL OPERATION
AIM:
To write and execute an assembly language program for performing logical OR,
AND, NAND operation in 8086 kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Load the First Data in AL-register.
2. Load the Second Data in BL-register.
3. Logically OR the content of AL with BL-register.
4. Store the result in memory location.
5. Stop the program
PROGRAM:
i) By using MASM: CODE
SEGMENT
ASSUME CS: CODE
START: MOV AL,
85H MOV BL, 99H
OR AL, BL
INT 3H
CODE ENDS
END START
OUTPUT:
INPUT OUTPUT
Register Data Address Data
AL 85H 1200H 9D
BL 95H
LOGICAL AND OPERATION
ALGORITHM:
1. Load the First Data in AL-register.
2. Load the Second Data in BL-register.
3. Logically AND the content of AL with BL-register.
4. Store the result in memory location.
5. Stop the program
PROGRAM:
i) By using MASM:
CODE SEGMENT
ASSUME CS: CODE
START: MOV AL, 85H
MOV BL, 99H
AND AL, BL
INT 3H
CODE ENDS
END START
OUTPUT:
INPUT OUTPUT
Register Data Address Data
AL 85H 1200H 81H
BL 95H
ALGORITHM:
1. Load the First Data in AL-register.
2. Load the Second Data in BX-register.
3. Logically AND the content of AX with BX-register.
4. Logically the content of AX register is complemented.
5. Store the result in memory location.
6. Stop the program
PROGRAM:
i) By using MASM:
CODE SEGMENT
ASSUME CS: CODE
START: MOV AL,
85H MOV BL, 99H
ADD AL, BL
NOT AL
INT 3H
CODE
ENDS END
START
VIVA QUESTIONS:
1. What is a Microprocessor?
2. What is the need for timing diagram?
3. Define mnemonics.
4. What is the difference between min mode and max mode of 8086?
5. What is flag?
6. What is stack?
7. What is interrupt?
8. What are the various interrupts in 8086?
9. What is the difference between compiler and assembler?
RESULT:
Thus an assembly language program for performing logical OR, AND, NAND operation
was executed using MASM and 8086
Ex. No: 2 MOVE A DATA BLOCK WITHOUT OVERLAP
AIM:
To write and execute an assembly language program for transferring data from one block
to another block without overlapping using 8086 kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Initialize counter.
2. Initialize source block pointer.
3. Initialize destination block pointer.
4. Get the byte from source block.
5. Store the byte in destination block.
6. Increment source, destination pointers and decrement counter.
7. Repeat steps 4, 5 and 6 until counter equal to zero.
8. Stop.
PROGRAM:
i) By using MASM:
DATA SEGMENT
ARRAY1 DW 1111H,2222H,3333H,4444H,5555H
ARRAY2 DW 5 DUP (0)
COUNT DW 0005H
CODE SEGMENT
MOV AX,@DATA
MOV DS, AX
LEA SI, ARRAY1
LEA DI, ARRAY2
MOV CX, COUNT
NEXT: MOV AX,[SI]
MOV DI, 1200H
MOV [DI], AX
INC SI
INC SI
INC DI
INC DI
LOOP NEXT
MOV AH, 4Ch
INT 21h
END
OUTPUT:
INPUT OUTPUT
Address Data Address Data
1200 55 1300 55
1201 65 1301 65
1202 75 1302 75
1203 85 1303 85
1204 95 1304 95
1205 A5 1305 A5
VIVA QUESTIONS:
Thus an assembly language program for transferring data from one block to another
block without overlapping was executed using 8086 kit and MASM.
Ex. No: 3A CODE CONVERSION
AIM:
To write and execute an assembly language program for converting BCD to Binary
data, packed to unpacked BCD code using 8086 kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Load the address of BCD data in SI-register.
2. Copy the BCD data to BL-register
3. Get the BCD data in AL-register.
4. Copy the BCD data in DL-register from AL-register.
5. Logically AND DL with 0Fh to mask upper nibble and get unit‟s digit in DL-reg.
6. Move the count value for rotation in CL-register.
7. Rotate the content of AL to move the upper nibble to lower nibble position.
8. Move 0Ah to DH-register.
9. Multiply AL with DH-register. The product will be in AL-register.
10. Add the unit‟s digit in DL-register to product in AL-register.
11. Save the binary data (AL) in memory.
12. Stop.
PROGRAM:
i) By using MASM:
CODE SEGMENT
ASSUME CS: CODE, DS: CODE
MOV BL, 75
MOV AL, BL
MOV DL, AL
AND DL, 0FH
AND AL, 0F0H
MOV CL, 4
ROR AL, CL
MOV DH, 0AH
MUL DH
ADD AL, DL
MOV [BX+1], AL
MOV SI, 1200H
MOV [SI], BX
MOV AH, 4CH
INT 21H
CODE ENDS
END
OUTPUT:
INPUT OUTPUT
Register Data Address Data
BL 7410 1200 4Bh
ALGORITHM:
1. Load number into AL-register with packed BCD data.
2. Mask the lower nibble.
3. Rotate 4 times to right to make MSB=LSB.
4. Display the digit.
5. Load number into AL-register with upper nibble.
6. Mask upper nibble.
7. Display the result in memory location.
8. Stop.
PROGRAM:
i) By using MASM:
CODE SEGMENT
ASSUME CS: CODE, DS: CODE
MOV AX, 45h
MOV AH, AL
MOV CL, 4h
SHR AH, CL
AND AX, 0F0FH
MOV SI, 1200H
MOV [SI], AX
INT 3H
CODE ENDS
END
OUTPUT:
INPUT OUTPUT
Register Data Address Data
AX 45H 1200 05
1201 04
RESULT:
Thus an assembly language program for converting BCD to Binary data, packed to unpacked
BCD code using 8086 kit and MASM was implemented and its output was verified.
Ex. No: 3B DECIMAL OPERATIONS
AIM:
To write and execute an assembly language program to add, subtract, multiply and
divide two 8-bit BCD data using 8086 kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Get the 1st BCD number.
2. Get the 2nd BCD number.
3. Add two BCD numbers.
4. Adjust result to valid BCD numbers.
5. Display the result.
PROGRAM:
i) By using MASM:
CODE SEGMENT
ASSUME CS: CODE
MOV AL, 09H
MOV BL, 02H
ADD AL, BL
DAA
MOV CH, 02H
MOV SI, 1400H
MOV [SI], AL
MOV CL, 04H
MOV BH, AL
L2: ROL BH, CL
MOV DL, BH
AND DL, 0FH
CMP DL, 09
JBE L4
ADD DL, 07
L4: ADD DL, 30H
MOV AH, 02
INT 21H
DEC CH
JNZ L2
MOV AH, 4CH
INT 21H
CODE ENDS
END
OUTPUT:
INPUT OUTPUT
Register Data Address Data
AL 09 1400 11
BL 02
BCD SUBTRACTION
ALGORITHM:
1. Get the 1st BCD number.
2. Get the 2nd BCD number.
3. Subtract two BCD numbers.
4. Adjust result to valid BCD numbers.
5. Display the result.
PROGRAM:
i) By using MASM:
CODE SEGMENT
ASSUME CS: CODE
MOV AL, 32H
MOV BL, 17H
SUB AL, BL
DAS
MOV CH, 02H
MOV SI, 1400H
MOV [SI], AL
MOV CL, 04H
MOV BH, AL
L2: ROL BH, CL
MOV DL, BH
AND DL, 0FH
CMP DL, 09
JBE L4
ADD DL, 07
L4: ADD DL, 30H
MOV AH, 02
INT 21H
DEC CH
JNZ L2
MOV AH, 4CH
INT 21H
CODE ENDS
END
OUTPUT:
INPUT OUTPUT
Register Data Address Data
AL 32 1400 15
BL 17
BCD MULTIPLICATION
ALGORITHM:
PROGRAM:
ii) By using MASM:
CODE SEGMENT
ASSUME CS: CODE
MOV AL, 04H
MOV BL, 06H
MUL BL
AAM
MOV CH, 04H
MOV SI, 1400H
MOV [SI], AX
MOV CL, 04H
MOV BH, AL
L2: ROL BH, CL
MOV DL, BH
AND DL, 0FH
CMP DL, 09
JBE L4
ADD DL, 07
L4: ADD DL, 30H
MOV AH, 02
INT 21H
DEC CH
JNZ L2
MOV AH, 4CH
INT 21H
CODE ENDS
END
iv) By using 8086 kit:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
1000 Org 1000h Starting address of the program
1000 C6 C0 32 MOV AL, 06H Load AL-reg with data 04h.
OUTPUT:
INPUT OUTPUT
Register Data Address Data
AL 04 1400 04
BL 06 1401 02
BCD DIVISION
ALGORITHM:
1. Get the 1st BCD number.
2. Get the 2nd BCD number.
3. Multiply two BCD numbers.
4. Adjust result to valid BCD numbers.
5. Display the result.
PROGRAM:
i). By using MASM:
CODE SEGMENT
ASSUME CS: CODE
MOVAL, 000FH
MOV BL, 08H
DIV BL
MOV CH, 04H
MOV SI, 1400H
MOV [SI], AX
MOV SI, 1402H
MOV [SI], BL
MOV CL, 04H
MOV BH, AL L2:
ROL BH, CL MOV
DL, BH AND DL,
0FH
CMP DL, 09
JBE L4
ADD DL, 07
L4: ADD DL, 30H
MOV AH, 02
INT 21H DEC
CH
JNZ L2
MOV AH,
4CH INT 21H
CODE ENDS
END
1003 C6,C3,08 MOV BL, 08H Load BL-reg with data 08h.
1006 F6,F3 DIV BL Divide the contents of AL-reg with
BL-register and the result will be
stored in AL-register.
1008 C6,C5,04 MOV CH, 04H Count of digits to be displayed
100b C7,C6,00,14 MOV SI, 1400H Load SI-reg with address 1400.
1011 C7,C6,02,14 MOV SI, 1402H Load SI-reg with address 1402.
OUTPUT:
INPUT OUTPUT
Register Data Address Data
AL F(Dividend) 1400 01(Quotient)
BL 08(Divisor) 1401 07(Remainder)
RESULT:
Thus an assembly language program for performing addition, subtraction,
multiplication and division of two 8-bit BCD numbers was performed and its output was verified
Ex. No: 3C MATRIX ADDITION
AIM:
To write and execute an assembly language program for performing addition of two
matrices using 8086 kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Get the 1st BCD number.
2. Get the 2nd BCD number.
3. Multiply two BCD numbers.
4. Adjust result to valid BCD numbers.
5. Display the result.
PROGRAM:
i). By using MASM:
.MODEL SMALL
.DATA
M1 DB 00H,01H,10H,12H,02H,03H,0F0H,0C0H,04H
M2 DB 00H,05H,01H,02H,50H,90H,03H,04H,0AAH
.CODE
.STARTUP
MOV BX, OFFSET M1
MOV BP, OFFSET
M2 MOV SI, 0001H
MOV CL, 09H
REPEAT: MOV
AL,[BX+SI] ADD AL,
[BP+SI]
MOV [DI],
AL INC SI
INC DI
LOOP REPEAT
MOV AH,
4CH INT 21H
END
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA Address Data
1300 00H 1400 00H 1501 00
1301 01H 1401 05H 1502 06
1302 10H 1402 01H 1503 11
1303 12H 1403 02H 1504 14
1304 02H 1404 50H 1505 52
1305 03H 1405 90H 1506 93
1306 0F0H 1406 03H 1507 F3H
1307 0C0H 1407 04H 1508 C4H
1308 04H 1408 0AAH 1509 AEH
VIVA QUESTIONS:
RESULT:
Thus an assembly language program for performing addition of two matrices numbers
was performed and its output was verified.
Ex. No: 4A FLOATING POINT OPERATIONS
AIM:
To write and execute an assembly language program for computing the area of a circle
using 8087 instruction using 8086 kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Start
2. Initialize the 8087 processor.
3. Fetch the Radius from Memory location 1500h.
4. To obtain r2 multiply using the instruction ST with ST (0)
5. Then π is loaded employing a constant load operation.
6. Now perform π*r*r using fmul instruction.
7. Now convert the resultant data to packed decimal before storing it in memory location.
8. Store the result in memory location 1600H.
9. Stop.
PROGRAM:
(i) BY USING MASM:
.MODEL SMALL
.DATA
RADIUS DD
3.4
AREA DD
? END
.CODE
MOV
AX,@DATA
MOV DS,AX
FINIT
FLD RADIUS
FMUL ST,
ST(0) FLDPI
FMUL
FSTP
AREA END
i) By using 8086 kit:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
1000 9B DB E3 FINIT Initialize
1003 PB DF 06 FILD DS:[1500H] radius
0015
1008 9B D8 C8 FMUL ST, ST(0) St = r*r
100B 9B D9 EB FLDPI St (0) = pi
100E 9B D8 C9 FMUL ST, ST(1) St (1) = r*r
St = pi*r*r
1011 9B DF 36 0016 FBSTP DS: [1600H] Area
1016 F4 HLT Stop the program
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
1500 2 1600 12.56
RESULT:
Thus an assembly language program for finding the area of a circle using 8087 instruction was
performed and its output was verified.
Ex. No: 4B STRING OPERATIONS
AIM:
To write and execute an assembly language program to find the length and copying
string, using 8086 kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Load the source and destination index register with starting and the ending address
respectively.
2. Load the terminate data value as “FF”.
3. Load the content of source index to the AL register.
4. Increment SI register and compare with register AH.
5. If it is non- zero value, increment the memory location by using the control instruction
to store the data.
6. Compare the string byte with FF, if it is not equal, repeat.
7. Count the string byte till zero flag is set. If zero flag is set then store the count value to
the memory.
8. Terminate the program when FF is matched.
9. Stop
PROGRAM:
i) By using MASM:
INPUT:
OUTPUT:
STRING COPYING
ALGORITHM:
1. Load the source and destination index register with starting and the ending address
respectively.
2. Initialize the counter with the total number of words to be copied.
3. Clear the direction flag for auto incrementing mode of transfer.
4. Use the string manipulation instruction MOVSW with the prefix REP to copy a string from
source to destination.
5. Stop
PROGRAM:
i) By using MASM:
.MODEL
SMALL DATA
SEGMENT
SRC DB „MICROPROCESSOR‟
DB 10 DUP (?)
DST DB 20 DUP
(0) DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA, ES:
DATA START: MOV AX, DATA
MOV DS,
AX MOV ES,
AX LEA SI,
SRC LEA DI,
DST MOV
CX, 20 CLD
REP
MOVSB INT
3H CODE
ENDS END
START
ii) By using 8086 kit:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
1000 C7,C6,00,20 MOV SI,2000H Initialize the source address.
Initialize the destination
1003 C7,C7,00,21 MOV DI,2100H
address.
Initialize count value to the
1007 C7,C1,06,00 MOV CX,0006 H
count register.
100B C6,C4,55 MOV AH,55H Move 55 to AH register.
100E FC REPEAT: CLD Clear the direction flag.
100F A4 MOVSB Move the string byte.
Unconditional loop to
1010 E2,FB LOOP:REPEAT address specified by the
label REPEAT.
1013 F4 HLT Stop the program.
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
2000 55 2100 55
2001 55 2101 55
2002 55 2102 55
2003 55 2103 55
2004 55 2104 55
2005 55 2105 55
RESULT:
Thus an assembly language program for copying, finding the length of a string was
implemented and its output was verified.
Ex. No: 4C SORTING (ASCENDING AND DESCENDING ORDER)
AIM:
To write and execute an assembly language program to sort an array of numbers in
ascending and descending order.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
PROGRAM:
i) By using MASM:
.MODEL SMALL
.STACK 100
.DATA
NUM DB 12H, 45H, 79H, 66H
.CODE
START: MOV
AX,@DATA
MOV DS, AX
MOV BX, 3
LOOP2: MOV CX, BX
MOV DI, 0
MOV AL, NUM
[DI] MOV DX, DI
LOOP1: INC DI
CMP AL, NUM
[DI] JNB NEXT
MOV AL, NUM
[DI] MOV DX, DI
NEXT: LOOP LOOP1
XCHG AL, NUM [DI]
MOV SI, DX
MOV NUM [SI], AL
DEC BX
JNZ LOOP2
MOV AH, 4CH
INT 21H
END START
DESCENDING ORDER:
ii) By using MASM:
.MODEL SMALL
.STACK 100
.DATA
NUM DB 12H, 45H, 79H, 66H
.CODE
START: MOV AX,@DATA
MOV DS, AX
MOV BX, 3
LOOP2: MOV CX, BX
MOV DI, 0
MOV AL, NUM [DI]
MOV DX, DI
LOOP1: INC DI
CMP AL, NUM [DI]
JB NEXT
MOV AL, NUM [DI]
MOV DX, DI
NEXT: LOOP LOOP1
XCHG AL, NUM [DI]
MOV SI, DX
MOV NUM [SI], AL
DEC BX
JNZ LOOP2
MOV AH, 4CH
INT 21H
END START
ASCENDING ORDER:
iii) By using 8086 kit:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
Initialize the memory pointer.
1000 MOV SI, 2000
C7,C6,00,20
1004 8A,0C MOV CL,[SI] Move the content SI to CL.
1006 FE,C9 DEC CL Decrement the count value
1008 C7,C6,00,20 REPEAT: MOV SI,2000 Move 2000 to SI.
100c 8A,2C MOV CH,[SI] Move the content of to CH.
100e FE,CD DEC CH Decrement the CH by one.
1010 Increment the memory
46 INC SI
pointer
1011 8A,04 RECMP: MOV AL,[SI] Move the content of SI to AL.
1013 46 INC SI increment the memory
pointer
1014 Compare the content of AL
3A,04 CMP AL,[SI] and content of address hold
by SI.
1016 If carry occur jump to the
72,05 JC :AHEAD address specify by the label
AHEAD.
1018 Exchange the content of AL
86,04 XCHG AL,[SI] and the content hold by the
address specify in SI.
101a Exchange the content of AL
and the content hold by the
86,44,FF XCHG AL,[SI-1]
address specify in
SI-1.
101d Decrement the CH register by
FE,CD AHEAD: DEC CH
1.
101f 75,F0 In the count value not reach
JNZ :RECMP to zero jumps to address
specify by RECMP.
1021 FE,C9 DEC CL Decrement the content of CL.
1023 75,E3 In the count value not reach
JNZ: REPEAT to zero jump to address
specify by REPEAT.
1025 F4 HLT Stop the program
OUTPUT:
INPUT OUTPUT
Address Data Address Data
2000 05 2001 01
2001 05 2002 02
2002 04 2003 03
2003 03 2004 04
2004 02 2005 05
2005 01
DESCENDING ORDER:
iv) By using 8086 kit:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
1000 C7,C6,00,20 MOV SI, 2000 Initialize the memory pointer.
1004 8A,0C MOV CL,[SI] Move the content SI to CL.
1006 FE,C9 DEC CL Decrement the count value
1008 C7,C6,00,20 REPEAT: MOV SI,2000 Move 2000 to SI.
100C 8A,2C MOV CH,[SI] Move the content of to CH.
100E FE,CD DEC CH Decrement the CH by one.
1010 46 INC SI Increment the memory pointer
1011 8A,04 RECMP: MOV AL,[SI] Move the content of SI to AL.
1013 46 INC SI increment the memory pointer
1014 Compare the content of AL
3A,04 CMP AL,[SI] and content of address hold by
SI.
1016 73,05 JNC :AHEAD If carry occur jump to the
address specify by the label
AHEAD.
1018 Exchange the content of AL
86,04 XCHG AL,[SI] and the content hold by the
address specify in SI.
101a Exchange the content of AL
and the content hold by the
86,44,FF XCHG AL,[SI-1]
address specify in
SI-1.
101d Decrement the CH register by
FE,CD AHEAD: DEC CH
1.
101f 75,F0 In the count value not reach to
JNZ :RECMP zero jumps to address specify
by RECMP.
1021 FE,C9 DEC CL Decrement the content of CL.
1023 75,E3 In the count value not reach to
JNZ: REPEAT zero jump to address specify
by REPEAT.
1025 F4 HLT Stop the program
OUTPUT:
INPUT OUTPUT
Address Data Address Data
2000 05 2001 05
2001 05 2002 04
2002 04 2003 03
2003 03 2004 02
2004 02 2005 01
2005 01
RESULT:
Thus an assembly language program for sorting an array of number in
ascending and descending order was performed and its output was verified.
Ex.No:4C SEARCHING A NUMBER
AIM:
To write and execute an assembly language program for searching a number using 8086
kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Get the count in register for number of data.
2. Initialize the array address.
3. Compare the selected two numbers and check carry.
4. If bigger, store the largest value in accumulator.
5. Otherwise interchange the contents with register.
6. Decrement the count.
7. Continue the same operation till the count becomes zero.
8. Store the result in memory locations.
PROGRAM:
LARGEST:
(i) By using MASM: DATA
SEGMENT
X DW 0060H, 0020H, 0030H, 0040H, 0050H
MES DB 10, 13,'LARGEST NUMBER AMONG THE SERIES IS
$' DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS:
DATA START: MOV AX,
DATA
MOV DS, AX
MOV CX,
05H LEA SI,
X MOV AX,
[SI] DEC CX
UP: CMP AX, [SI+2]
JNB
CONTINUE
MOV AX,
[SI+2]
CONTINUE: ADD SI, 2
DEC CX
JNZ UP
AAM
ADD AX, 3030H
MOV BX, AX
MOV AH, 09H
LEA DX, MES
INT 21H
MOV DL, BH
MOV AH, 02H
INT 21H MOV
DL, BL INT
21H MOV AH,
4CH INT 21H
CODE ENDS
END START
OUTPUT:
INPUT OUTPUT
Address Data Address Data
2000 05 (COUNT) 2100 19
2001 15
2002 19
2003 02
2004 01
2005 06
SMALLEST:
OUTPUT:
INPUT OUTPUT
Address Data Address Data
2000 05 (COUNT) 2100 01
2001 15
2002 19
2003 02
2004 01
2005 06
VIVA QUESTIONS:
RESULT:
Thus an assembly language program for searching a smallest and largest
was performed and its output was verified.
Ex.No:5A PASSWORD CHECKING
AIM:
To write and execute an assembly language program for password checking using 8086
kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
PROGRAM:
i) By using MASM
.MODEL SMALL
.DATA
NAM DB
‟KRISHNA$‟ PASS
DB 50
DB?
DB 10 DUP (?)
MSG1 DB 10, 13,"ENTER THE PASSWORD: $", 10, 13
MSG2 DB 10, 13,"PASSWORD VALID: CONGRATS!!!! $", 10, 13
MSG3 DB 10, 13,"PASSWORD INVALID, SORRY TRY AGAIN ## $", 10, 13
PRINT MACRO MSG; MACRO DEFINITION TO PRINT A STRING ON
SCREEN LEA DX, MSG
MOV AH,
09 INT 21H
ENDM
.CODE
START: MOV
AX,@DATA
MOV DS, AX
MOV ES, AX
XOR AX, AX
PRINT MSG1
LEA DX, PASS
MOV AH, 0AH; READ PASSWORD FROM
KEYBOARD INT 21H
MOV DI,
DX INC DI
MOV CL, BYTE PTR [DI]; LENGTH OF THE STRING IN CL
REGISTER MOV CH, 00
INC DI
LEA SI,
NAM CLD
BACK: CMPSB JNE
XX LOOP
BACK
PRINT MSG2
JMP XXY
XX: PRINT MSG3
XXY: MOV AH, 4CH
INT 21H
END
START
(ii) By using 8086 kit:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
0000 E8,00,79 AGAIN: CALL CLRS Assign ASCII value for carriage
return
0003 E8,00,6F CALL POS Position The Cursor
0006 8C, C8 MOV AX,CS Initialize DS To Code Segment
0008 8E, D8 MOV DS,AX Copy The Content Of AX To
DS-Register
000A B4, 09 MOV AH,09H Load The Function Code IN
AH-register
000C BA, 04,50 MOV DX,450H Load address of string to display
in DX-register
000F CD, 21 INT 21H Call DOS service for display
0011 BE, 04,00 MOV SI,400H Initialize the pointer
0014 B9, 00,00 MOV CX,0000H Initialize count in CX-register as
zero.
0017 B4, 00 L1: MOV AH,00H Load the function code in AH.
0019 CD, 16 INT 16H Call BIOS to get keyboard
character in AL.
001B 3C,0D CMP AL,CR Compare the key code with
carriage return
001D 74,0C JE CHECK If equal go to CHECK
001F 88,04 MOV [SI],AL Store the keyboard character in
memory
0021 B4,02 MOV AH,02H Load the function code in AH.
0023 B2, 2A MOV DL, „*‟ Load the ASCII value of „*‟ in
DL
0025 CD,21 INT 21H Call DOS service for display
0027 46 INC SI Increment Pointer
0028 41 INC CX Increment the count
0029 EB,EC JMP L1 Jump to L1 to get next character
002B 83,F9,07 CHECK: CMP CX,0007H Compare count with 07H
002E 75,20 JNE REPEAT If count not equal to 07H then
goto repeat
0030 BE,04,00 MOV SI, 400H Initialize the pointers
0033 BF,05,00 MOV DI,500H Copy the value 500H to DI-reg
0036 8A,04 L2: MOV AL, [SI] Get a character of entered
password in AL-register
0038 3A,05 CMP AL,[DI] Compare entered character with
corresponding character of
stored password
003A 75,14 JNE REPEAT If not equal jump to repeat
003C 46 INC SI Increment the pointer
003D 47 INC DI Increment the DI-register
003E E2,F6 LOOP L2 Repeat comparison until counter
expires
0040 E8,00,79 CALL CLRS Clear the screen
0043 E8,00,6F CALL POS Position the cursor
0046 B4,09 MOV AX,09H Load the function code in AH-
register
004A BA,06,00 MOV DX,600H Load the address of String to
display in DX-register
004B CD,21 INT 21H Call DOS service for display
004D E9,06,0F JMP EXIT GO to EXIT.
0050 E8,00,79 REPEAT CALL CLRS Clear the screen
0053 E8,00,6F CALL POS Position the cursor
0056 B4,09 MOV AH,09H Load the function code in AH
0058 BA,05,50 MOV DX,550H Load the address of string to
display in DX-register
005B CD,21 INT 21H Call DOS service for display
005D B4,09 MOV AH,09H Load the function code in AH
005F BA,05,80 MOV DX,580H Load address of string to display
in DX
0062 CD,21 INT 21H Call DOS service for display
0064 B4,00 MOV AH,00H Load the function code in AH
0066 CD,16 INT 16H Call Bios service to get
keyboard
0068 3C,1B CMP AL,1BH Check for Esc key
006A 75,94 JNE AGAIN If key pressed is not esc, then go
to again
006C E9,06,0F JMP EXIT If key pressed is not esc, then go
to exit
006F B4,02 MOV AH,02H Load the function code in AH
0071 B7,00 MOV BH,00H Load the video page in BH
0073 BA,00,00 MOV DX,0000H Load the X and Y coordinate in
DL and DH.
0076 CD ,10 INT 10H Call Bios service for cursor
positioning
0078 C3 RET Return to main program
0079 POS ENDP End of procedure to position the
cursor
0079 CLRS PROC NEAR Start of procedure to clear the
screen.
0079 B4,07 MOV AH,07H Load the function code in AH
007B B0,00 MOV AL,00H Load number of lines to scroll
down in AL
007D B7 07 MOV BH,07H Load the blanked area attribute
in BL
007F B9 0000 MOV CX, 0000H Load the X and Y coordinates of
upper left corner in CL and CH
0082 BA 184F MOV DX,184FH Load the X and Y coordinates
of lower right corner in DL and
DH
0085 CD 10 INT 10H Call BIOS video service for
clearing screen.
0087 C3 RET Return to main program
0088 CLRS ENDP End of procedure to clear the
screen.
0450 ORG 450H
0450 45 4E 54 45 DB „ENTER THE
52 20 54 48 PASSWORD : „,‟$‟
45 20 50 41
53 53 57 4F
52 44 20 3A
20 24
0500 ORG 500H
0500 57 45 4C 43 DB „WELCOME‟,‟$‟
4F 4D 45
24
0500 ORG 550H
0550 49 4E 43 4F DB „INCORRECT
52 52 45 43 PASSWORD. „,‟$.
54 20 50 41
53 53 57 4F
52 44 2E 20
20 24
0580 ORG 580H
0580 50 52 45 53 DB „ PRESS ANY KEY
53 20 41 4E TO TRY AGAIN OR
59 20 4B 45 PRESS ESC TO EXIT
59 20 54 4F „,‟$‟
20 54 52 59
20 41 41 41
49 4E 20 4F
52 20 50 52
45 53 53 20
45 53 43 20
54 4F 20 45
58 49 54 20
24
0600 ORG 600H
0600 45 4E 54 52 DB „ENTRY
59 20 41 43 ACCEPTED‟ ,‟$‟.
43 45 50 54
45 44 24
060F B4 4C EXIT MOV AH,4CH Load the function in AH
0611 CD 21 INT 21H Call DOS service to return to
command prompt.
0613 CODE ENDS Ends of code segment
END Assembly end
OUTPUT:
Thus an assembly language program for password checking using 8086 was implemented
and its output was verified
Ex.No:5B PRINT RAM SIZE
AIM:
To write and execute an assembly language program to print the size of the file in RAM
using 8086kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
PROGRAM:
i) By using MASM
PROMPT MACRO MESSAGE
PUSH AX
MOV AH, 09H
LEA DX, MESSAGE
INT 21H
POP AX
ENDM
DATA SEGMENT
MES DB 10, 13, 'THE SIZE OF CONVENTIONAL RAM MEMORY IS: $'
MES1 DB 'KBYTES$'
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE
LEA DX, MES
INT 12H
CALL D_BCD
LEA DX, MES1
MOV AH, 4CH
INT 21H
D_BCD PROC NEAR
MOV CX, 00H
MOV BX, 10H
BACK1: MOV DX, 00H
DIV BX
PUSH DX
INC CX
OR AX, AX
JNZ BACK1
MOV AH, 02H
DISP: POP DX
ADD DL, 30H
INT 21H
LOOP DISP
RET
ENDP
CODE ENDS
END
RESULT:
Thus an assembly language program to print the size of the file in RAM using 8086
was implemented and its output was verified.
Ex.No:5C SYSTEM DATE
AIM:
To write and execute an assembly language program for reading system date using
8086kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
PROGRAM:
i) By using MASM
.MODEL SMALL
.DATA
.CODE
START: MOV
AX,@DATA
MOV DS
; Day Part
DAY: MOV AH, 2AH ; To get System Date
INT 21H
MOV AL, DL ; Day is in DL
AAM
MOV BX, AX
CALL DISP
MOV DL,'/'
MOV AH, 02H ; To Print / in DOS
INT 21H
; Month Part
MONTH: MOV AH, 2AH ; To get System Date
INT 21H
MOV AL, DH ; Month is in DH
AAM
MOV BX, AX
CALL DISP
MOV DL,'/' ; To Print / in DOS
MOV AH, 02H
INT 21H
; Year Part
YEAR: MOV AH, 2AH ; To get System Date
INT 21H
ADD CX, 0F830H; To negate the effects of 16bit value,
MOV AX, CX ; since AAM is applicable only for AL (YYYY -> YY)
AAM
MOV BX, AX
CALL DISP
; Display Part
DISP PROC
MOV DL, BH ; since the values are in BX, BH Part
ADD DL, 30H ; ASCII Adjustment
MOV AH, 02H ; To Print in DOS
INT 21H
MOV DL, BL ; BL Part
ADD DL, 30H ; ASCII Adjustment
MOV AH, 02H ; To Print in DOS
INT 21H
RET
DISP ENDP ; End Disp Procedure
END START ; End of MAIN
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
1000 CALL CONVERT Call subroutine for conversion
1003 CALL DISPLAY Call subroutine for Display
1006 DELAY: MOV AL,0B0H Copy the data 0B0H to AL-reg
1009 OUT 16H,AL Configure output port
100B MOV CL,07H Copy the data 07H to AL-reg
100E S2: MOV AL,88H Copy 88H to AL- register
1011 OUT 14H,AL Configure output port
1013 MOV AL,80H Copy the data 80H to AL-reg
1016 OUT 14H,AL Configure output port
1018 S1: NOP No operation
1019 NOP No operation
101A NOP No operation
101B NOP No operation
101C IN AL,14H Copy 14H to AL-reg
101E MOV DL,AL Copy the Content of AL reg to
DL-reg.
1020 IN AL,14H Copy 14H to AL-reg
1022 OR AL,DL OR the contents of AL with DL
1024 JNZ S1 Jump on no zero to S1
1026 DEC CL Decrement CL-register
1028 JNZ S2 Jump on no zero to S2
102A MOV SI,1500H Copy SI-reg with data 1500H
102E MOV AL,[SI] Copy the content of SI-reg to AL
1030 INC AL Increment AL-register
1032 MOV [SI],AL Copy the content of AL reg to SI-
reg
1034 CMP AL,3CH Compare AL with 3CH
1037 JNZ START Jump on no zero to start
1039 MOV AL,00H Copy AL with data 00H
103C MOV [SI],AL Copy the content of Al to SI-reg
103E INC SI Increment SI-register
103F MOV AL,[SI] Copy the content of SI-reg to AL
1041 INC AL Increment AL-register
1043 MOV [SI],AL Copy the content of AL reg to SI-
reg
1045 CMP AL,3CH Compare AL with 3CH
1048 JNZ START Jump on no zero to start
104A MOV AL,0 Copy AL with data 00H
104D MOV [SI],AL Copy the content of AL reg to SI-
reg
104F INC SI Increment SI-register
1050 MOV AL,[SI] Copy the content of SI-reg to AL
1052 INC AL Increment AL-register
1054 MOV [SI],AL Copy the content of AL reg to SI-
reg
1056 CMP AL,18H Compare AL with 18H
1059 JNZ START Jump on no zero to start
105B MOV AL,0 Copy AL with data 00H
105E MOV [SI],AL Copy the content of AL reg to SI-
reg
1060 JMP START Jump to start
1063 DISPLAY: MOV AH,06H Copy 06H to AH-register
1066 MOV DX,1600H Copy 1600H to DX-register
106A MOV CH,01H Copy 01H to CH-register
106D MOV CL,0H Copy 00H to CL-register
1070 INT 5 Call Interrupt
1072 RET Return from subroutine
1073 CONVERT: MOV SI,1500H Copy 1500H to SI-register
1077 MOV BX,1608H Copy 1608H to BX-register
107B MOV AL,24H Copy 24H to AL- register
107E MOV [BX],AL Copy the content of AL-reg to BX
1080 MOV AL,[SI] Copy the content of SI-reg to AL
1082 MOV AH,0 Copy AL with data 00H
1085 MOV DH,0AH Copy the data 0AH to DH-register
1088 DIV DH Divide DH-reg by AH reg
108A ADD AH,30H Add the data 30H with AH-reg
108D DEC BX Decrement BX-register
108E MOV [BX],AH Copy the data from AH to DH-
reg
1090 DEC BX Decrement BX-register
1091 ADD AL,30H Add the data 30H with AL-reg
1094 MOV [BX],AL Copy the data from AL to BX-reg
1096 DEC BX Decrement BX-register
1097 MOV AL,3AH Copy the 3AH to AL-reg
109A MOV [BX],AL Copy the data from AL to BX-reg
109C DEC BX Decrement BX-register
109D INC SI Increment SI-register
109E MOV AL,[SI] Copy the content of SI-reg to AL
10A0 MOV AH,0 Copy the data 0 to AH-reg
10A3 MOV DH,0AH Copy the data 0AH to DH-register
10A6 DIV DH Divide DH-reg by AH reg
10A8 ADD AH,30H Add the data 30H with AH-reg
10AB MOV [BX],AH Copy the data from AH to BX-
reg
10AD DEC BX Decrement BX-register
10AE ADD AL,30H Add the data 30H with AL-reg
10B1 MOV [BX],AL Copy the data from AL to BX-reg
10B3 DEC BX Decrement BX-register
10B4 MOV AL,3AH Copy the 3AH to AL-reg
10B7 MOV [BX],AL Copy the data from AL to BX-reg
10B9 DEC BX Decrement BX-register
10BA INC SI Increment SI-register
10BB MOV AL,[SI] Copy the content of SI-reg to AL
10BD MOV AH,0 Copy the data 0 to AH-reg
10C0 MOV DH,0AH Copy the data 0AH to DH-register
10C3 DIV DH Divide DH-reg by AH reg
10C5 ADD AH,30H Add the data 30H with AH-reg
10C8 MOV [BX],AH Copy the data from AH to BX-
reg
10CA DEC BX Decrement BX-register
10CB ADD AL,30H Add the data 30H with AL-reg
10CE MOV [BX],AL Copy the data from AL to BX-reg
10D0 RET Return from subroutine
10D1 GETC: IN AL,02H Copy 02H to AL-reg
10D3 AND AL,0FFH AND data AL with 0FFH
10D6 CMP AL,0F0H Compare AL with 0F0H
10D9 JNE GETC If no zero jump to getc
OUTPUT:
1500- 99 YEAR
1501- 09 MONTH
1502- 09 DATE
VIVA QUESTIONS:
RESULT:
Thus an assembly language program for reading system date using 8086 was
implemented and its output was verified.
Ex.No:6 COUNTERS AND TIME DELAY
AIM:
To write and execute an assembly language program for creating time delay using counters
in 8086kit and MASM.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
PROGRAM:
i) By using MASM
.MODEL SMALL
.DATA
MSGIN DB 'Enter delay duration (0-50): $'
MSG1 DB 'This is Microprocessor!$'
DELAYTIME DW 0000H
.CODE
MOV DX,@DATA
MOV DS, DX LEA
DX, MSGIN MOV
AH, 09H INT 21H
OUTPUT:
WAVEFORM GENERATION
WAVEFORMS AMPLITUDE TIME PERIOD
Square wave 10v 1ms
VIVA QUESTIONS:
RESULT:
Thus an assembly language program for creating time delay using counters in 8086
was implemented and its output was verified.
INTERFACING EXPERIMENTS
Ex. No: 7 TRAFFIC LIGHT CONTROL
AIM:To write and execute an assembly language Program for interfacing the Traffic Light Controller
in 8086 kit.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Traffic Light Controller Interface board 1----
3. Power card ---- 1
4. Keyboard ---- 1
5. PC with Intel/AMD Processor---- 1
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
1000 B0,80 START: MOV AL,80H Move 80 to AL-register
1002 E6,26 OUT CONTROL,AL Copy the AL-reg content to
output port.
1004 BB 6B 10 REPEAT: MOV BX, LOOKUP Copy the lookup data value
to BX-register
1007 BE 77 10 MOV SI, LABEL Copy the direction of rotation
value to SI-reg.
100A E8 32 00 CALL OUT Call to OUT port
100D 8A 04 MOV AL, [SI] Copy the contents of SI-reg
to Al-register
100F E6 20 OUT PORTA, AL Move the AL-reg value to
PORTA
1011 E8 4A 00 CALL DELAY1 Call Delay program
1014 46 INC SI Increment SI-register
1015 43 INC BX Increment BX-register
1016 E8 26 00 CALL OUT Call to OUT port
1019 8A 04 MOV AL, [SI] Copy the contents of SI-reg
to Al-register
101B E6 22 OUT PORTB, AL Move the AL-reg value to
PORTB
101D E8 3E 00 CALL DELAY1 Call Delay program
1020 46 INC SI Increment SI-register
1021 43 INC BX Increment BX-register
1022 E8 1A 00 CALL OUT Call to OUT port
1025 8A 04 MOV AL, [SI] Copy the contents of SI-reg
to Al-register
1027 E6 24 OUT PORTC, AL Move the AL-reg value to
PORTC
1029 E8 32 00 CALL DELAY1 Call Delay program
102C 46 INC SI Increment SI-register
102D 43 INC BX Increment BX-register
102E E8 0E 00 CALL OUT Call to OUT port
1031 8A 04 MOV AL, [SI] Copy the contents of SI-reg
to Al-register
1033 E6 24 OUT PORTC, AL Move the AL-reg value to
PORTC
1035 46 INC SI Increment SI-register
1036 8A 04 MOV AL, [SI] Copy the contents of SI-reg
to Al-register
1038 E6 20 OUT PORTC, AL Move the AL-reg value to
PORTC
103A E8 21 00 CALL DELAY1 Call Delay program
103D EB C5 JMP REPEAT Jump to label REPEAT
103F 8A 07 OUT: MOV AL, [BX] Copy the content of BX to
AL-register
1041 E6 24 OUT PORTC, AL Move the AL-reg value to
PORTC
1043 43 INC BX Increment BX-register
1044 8A 07 MOV AL, [BX] Copy the content of BX to
AL-register
1046 E6 22 OUT PORTB, AL Move the AL-reg value to
PORTB
1048 43 INC BX Increment BX-register
1049 8A 07 MOV AL, [BX] Copy the content of BX to
AL-register
104B E6 20 OUT PORTA, AL Move the AL-reg value to
PORTA
104D E8 01 00 CALL DELAY Call Delay program
1050 C3 RET Return from subroutine
1051 BF 40 00 DELAY: MOV DI, 00040H Move 40h to DI-register
1054 BA FF FF A: MOV DX, 0FFFFH Move 0FFFFh to DX-register
1057 4A A1: DEC DX Decrement DX-register
1058 75 FD JNZ A1 Jump on no zero to A1.
105A 4F DEC D1 Decrement D1-register
105B 75 F6 JNZ A Jump on no zero to A
105D C3 RET
105E BF 15 00 DELAY1: MOV DI, 00015H Move 15h to DI-register
1061 BA FF FF B: MOV DX, 0FFFH Move 0FFFh to DX-register
1064 4A B1: DEC DX Decrement DX-register
1065 75 FD JNZ B1 Jump on no zero to B1
1067 4F DEC D1 Decrement D1-register
1068 75 F6 JNZ B Jump on no zero to B
106A C3 RET
106B 12 27 44 10 LOOKUP: DB 12H,27H,44H,10H
106F 2B 92 109D 2BH,92H,10H,9DH
1073 84 48 2E 84 84H,48H,2EH,84H
1077 48 4B 20 49 LABEL: DB 48H,4BH,20H,49H
107B 04 04H For traffic light control.
107C END
VIVA QUESTIONS:
1. Which Segment is used to store interrupt and subroutine return address registers?
2. What is the difference between instructions RET & IRET?
3. What .model small means?
4. Difference between small, medium, tiny, huge?
5. What is dd, dw, db?
5. What is the function of 01h of Int 21h, 02h of Int 21h, 09h
of Int 21h, 0Ah of Int 21h, 4ch of Int 21h?
Ex.No:8 STEPPER MOTOR INTERFACING
AIM:
To write and execute an assembly language Program to run a stepper motor at
different speed, and to control its speed of direction.
APPARATUS:
----
1. 8086 microprocessor kit/MASM 1
2. Stepper Motor ----1
3. Stepper Motor Interface board ---- 1
4. Power card ---- 1
5. Keyboard ----1
6. PC with Intel/AMD Processor---- 1
PROGRAM:
1000 C7,C7,18,10 Ahead MOV DI, 1018 Copy the data 1018 to DI-reg
1007 8A, 05 Loop1 MOV AL, [DI] Copy the content of DI-reg to
AL- register
1009 E6 , C0 OUT C0, AL The content of AL is moved to
Out port
100B C7,C2,10,10 MOV DX, 1010 Copy the data 1010 to DX-reg
100F 4A loop DEC DX Decrement DX-register
1010 75,FD JNZ loop Jump on no zero to loop
1012 47 INC DI Increment DI-register
1013 E2,F2 LOOP loop1 Loop to label loop1
1015 E9,E8, FF JMP Ahead Jump to ahead
1018 09,05,06,0A TABLE 09 05 06 0A
HLT Stop the program.
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
1003 C7,C7,3F,10 MOV DI, 103F Copy the data 103F to DI-reg
VIVA QUESTIONS:
RESULT:
Thus an assembly language Program to run the stepper motor in both forward and reverse
direction with delay was executed and its output was verified.
Ex. No: 9 DIGITAL CLOCK
AIM:
To write and execute an assembly language Program for digital clock in 8086 kit.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. Traffic Light Controller Interface board ---- 1
3. Power card ---- 1
4. Keyboard 1----
5. PC with Intel/AMD Processor---- 1
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
1000 CALL CONVERT Call subroutine for conversion
1003 CALL DISPLAY Call subroutine for Display
1006 DELAY: MOV AL,0B0H Copy the data 0B0H to AL-reg
1009 OUT 16H,AL Configure output port
100B MOV CL,07H Copy the data 07H to AL-reg
100E S2: MOV AL,88H Copy 88H to AL- register
1011 OUT 14H,AL Configure output port
1013 MOV AL,80H Copy the data 80H to AL-reg
1016 OUT 14H,AL Configure output port
1018 S1: NOP No operation
1019 NOP No operation
101A NOP No operation
101B NOP No operation
101C IN AL,14H Copy 14H to AL-reg
101E MOV DL,AL Copy the Content of AL reg to
DL-reg.
1020 IN AL,14H Copy 14H to AL-reg
1022 OR AL,DL OR the contents of AL with DL
1024 JNZ S1 Jump on no zero to S1
1026 DEC CL Decrement CL-register
1028 JNZ S2 Jump on no zero to S2
102A MOV SI,1500H Copy SI-reg with data 1500H
102E MOV AL,[SI] Copy the content of SI-reg to AL
1030 INC AL Increment AL-register
1032 MOV [SI],AL Copy the content of AL reg to SI-
reg
1034 CMP AL,3CH Compare AL with 3CH
1037 JNZ START Jump on no zero to start
1039 MOV AL,00H Copy AL with data 00H
103C MOV [SI],AL Copy the content of Al to SI-reg
103E INC SI Increment SI-register
103F MOV AL,[SI] Copy the content of SI-reg to AL
1041 INC AL Increment AL-register
1043 MOV [SI],AL Copy the content of AL reg to SI-
reg
1045 CMP AL,3CH Compare AL with 3CH
1048 JNZ START Jump on no zero to start
104A MOV AL,0 Copy AL with data 00H
104D MOV [SI],AL Copy the content of AL reg to SI-
reg
104F INC SI Increment SI-register
1050 MOV AL,[SI] Copy the content of SI-reg to AL
1052 INC AL Increment AL-register
1054 MOV [SI],AL Copy the content of AL reg to SI-
reg
1056 CMP AL,18H Compare AL with 18H
1059 JNZ START Jump on no zero to start
105B MOV AL,0 Copy AL with data 00H
105E MOV [SI],AL Copy the content of AL reg to SI-
reg
1060 JMP START Jump to start
1063 DISPLAY: MOV AH,06H Copy 06H to AH-register
1066 MOV DX,1600H Copy 1600H to DX-register
106A MOV CH,01H Copy 01H to CH-register
106D MOV CL,0H Copy 00H to CL-register
1070 INT 5 Call Interrupt
1072 RET Return from subroutine
1073 CONVERT: MOV SI,1500H Copy 1500H to SI-register
1077 MOV BX,1608H Copy 1608H to BX-register
107B MOV AL,24H Copy 24H to AL- register
107E MOV [BX],AL Copy the content of AL-reg to BX
1080 MOV AL,[SI] Copy the content of SI-reg to AL
1082 MOV AH,0 Copy AL with data 00H
1085 MOV DH,0AH Copy the data 0AH to DH-register
1088 DIV DH Divide DH-reg by AH reg
108A ADD AH,30H Add the data 30H with AH-reg
108D DEC BX Decrement BX-register
108E MOV [BX],AH Copy the data from AH to DH-
reg
1090 DEC BX Decrement BX-register
1091 ADD AL,30H Add the data 30H with AL-reg
1094 MOV [BX],AL Copy the data from AL to BX-reg
1096 DEC BX Decrement BX-register
1097 MOV AL,3AH Copy the 3AH to AL-reg
109A MOV [BX],AL Copy the data from AL to BX-reg
109C DEC BX Decrement BX-register
109D INC SI Increment SI-register
109E MOV AL,[SI] Copy the content of SI-reg to AL
10A0 MOV AH,0 Copy the data 0 to AH-reg
10A3 MOV DH,0AH Copy the data 0AH to DH-register
10A6 DIV DH Divide DH-reg by AH reg
10A8 ADD AH,30H Add the data 30H with AH-reg
10AB MOV [BX],AH Copy the data from AH to BX-
reg
10AD DEC BX Decrement BX-register
10AE ADD AL,30H Add the data 30H with AL-reg
10B1 MOV [BX],AL Copy the data from AL to BX-reg
10B3 DEC BX Decrement BX-register
10B4 MOV AL,3AH Copy the 3AH to AL-reg
10B7 MOV [BX],AL Copy the data from AL to BX-reg
10B9 DEC BX Decrement BX-register
10BA INC SI Increment SI-register
10BB MOV AL,[SI] Copy the content of SI-reg to AL
10BD MOV AH,0 Copy the data 0 to AH-reg
10C0 MOV DH,0AH Copy the data 0AH to DH-register
10C3 DIV DH Divide DH-reg by AH reg
10C5 ADD AH,30H Add the data 30H with AH-reg
10C8 MOV [BX],AH Copy the data from AH to BX-
reg
10CA DEC BX Decrement BX-register
10CB ADD AL,30H Add the data 30H with AL-reg
10CE MOV [BX],AL Copy the data from AL to BX-reg
10D0 RET Return from subroutine
10D1 GETC: IN AL,02H Copy 02H to AL-reg
10D3 AND AL,0FFH AND data AL with 0FFH
10D6 CMP AL,0F0H Compare AL with 0F0H
10D9 JNE GETC If no zero jump to getc
OUTPUT:
1500- 00 SECONDS
1501- 00 MINUTES
1502- 09 HOURS
VIVA QUESTIONS:
RESULT:
Thus an assembly language Program for digital clock in 8086 kit was written and executed.
Ex.No:10 KEYBOARD AND DISPLAY
AIM:
To write and execute an assembly language Program to display the rolling message “HELP US “in the
display.
APPARATUS:
1. 8086 microprocessor kit/MASM ----1
2. 8279 Interface board ----1
4. Power card ----1
5. Keyboard ----1
6. PC with Intel/AMD Processor----1
ALGORITHM:
Display of rolling message “HELP US “
1. Initialize the counter
2. Set 8279 for 8 digit character display, right entry
3. Set 8279 for clearing the display
4. Write the command to display
5. Load the character into accumulator and display it
6. Introduce the delay
7. Repeat from step 1.
PROGRAM:
ADDRESS OPCODE LABEL PROGRAM COMMENTS
1000 BE 00 START MOV SI,1200H Initialize array
1003 B9 0F MOV CX,000FH Initialize array size
1006 B0 10 MOV AL,10 Store the control word for
display mode
1008 E6 C2 OUT C2,AL Send through output port
100A B0 CC MOV AL,CC Store the control word to
clear display
100C E6 C2 OUT C2,AL Send through output port
100E B0 90 MOV AL,90 Store the control word to
write display
1010 E6 C2 OUT C2,AL Send through output port
1012 8A 04 NEXT MOV AL,[SI] Get the first data
1014 E6 C0 OUT C0,AL Send through output port
1016 E8 E7 CALL DELAY Give delay
1019 46 INC SI Go & get next data
101A E2 F6 LOOP NEXT Loop until all the data‟s have
been taken
101C EB E2 JMP START Go to starting location
1500 BA FF A0 DELAY MOV DX,0A0FFH Store 16bit count value
1503 4A LOOP1 DEC DX Decrement count value
1504 74 FD JNZ LOOP1 Loop until count values
becomes zero
1506 C3 RET Return to main program
LOOK-UP TABLE:
1200 98 68 7C C8
1204 FF 1C 29 FF
RESULT: Thus the rolling message “HELP US” is displayed using 8279 interface kit
Ex.No:11 PRINTER INTERFACE
AIM:
To write and execute an assembly language program for printer interface with
microprocessor 8086 kit and to print a single character “A”.
APPARATUS REQUIRED:
PROGRAM:
00C8 DATA EQU 00C8H
00D0 CONTL EQU 00D0H
00C0 STUS EQU 00C0H
VIVA QUESTIONS:
RESULT:
Thus an assembly language program for printer interface to print a single character
“A” was performed and its output was verified.
Ex.No:12A SERIAL INTERFACE
AIM:
To write and execute assembly language program to establish serial communication
between two 8086 kits.
APPARATUS REQUIRED:
1. 8086 microprocessor kit/MASM ----2
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Initialize 8253 and 8251 to check the transmission and reception of a character
2. Initialize8253 to give an output of 150 KHz at channel 0 which will give a 9600 baud rate of
8251.
3. The command word and mode word is written to the 8251 to set up for subsequent operations
4. The status word is read from the 8251 on completion of a serial I/O operation, or when the
host CPU is checking the status of the device before starting the next I/O operation
PROGRAM:
TRANSMITTER END:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
OUTPUT:
RESULT:
AIM:
To write and execute assembly language program to establish parallel communication
between two 8086 kits.
APPARATUS REQUIRED:
1. 8086 microprocessor kit/MASM ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Initialize accumulator to hold control word
2. store control word in control word register
3. Read data port A.
4. Store data from port A in memory
5. Place contents in port B
PROGRAM:
TRANSMITTER:
ADDRESS OPCODE LABEL PROGRAM COMMENTS
1000 C6, C0,82 MOV AL,82H Copy 82H to AL-register
1003 E6,26 OUT 26H,AL Configure output port
1005 C6,C0,3F MOV AL,3FH Copy 3F to AL-register
1008 E6,20 OUT 20H,AL Configure output port
100a E4,22 Loop: IN AL,22H Configure AL-register
100c 80,E8,3f SUB AL,3FH Subtract 3F from AL-register
100f 75,F9 JNZ LOOP Jump on no zero to loop
1011 C6,C0,24 MOV AL,24H Copy 24H to AL-register
1014 E6,20 OUT 20H,AL Configure output port
1016 E8,02,00 CALL DELAY Call delay program
1019 CD,02 INT 02 Call interrupt routine
101b C6,C3,05 Delay: MOV BL,05H Copy 05H to BL-register
101e C6,C2,FF Lion: MOV DL,0FFH Copy FFH to DL-register
1021 FE,CA L2: DEC DL Decrement DL-register
1023 75,F9 JNZ L2 Jump on no zero to Label L2
1025 FE,CB DEC BL Decrement BL-register
1027 75,F5 JNZ LION Jump on no zero to lion
1029 C3 RET Return from subroutine
RECEIVER:
ADDRESS OPCODE LABEL PROGRAM COMMENTS
1000 C6 C0 90 MOV AL,90H Copy 90H to AL- register
1003 E6 26 OUT 26H,AL Configure output port
1005 E4 20 CHECK: IN AL,20H Configure AL-register
1007 80 E8 3F SUB AL,3FH Subtract 3F from AL-register
100A 75 F9 JNZ CHECK Jump on no zero to loop
100C C6 C0 3F MOV AL,3FH Copy 3FH to AL-register
100F E6 22 OUT 22H,AL Configure output port
1011 C6 C1 08 MOV CL,08H Copy 08H to AL-register
1014 E8 12 00 CALL DELAY Call delay program
1017 C7,C6,00,12 MOV SI,1200H Copy 1200H TO SI-register
VIVA QUESTIONS:
1. What is Baud rate?
2. What is the difference between synchronous and asynchronous communication?
3. What is the expansion of RS?
4. What is the expansion of USART?
5. What is the role of RS-232?
6. What type of interface is 8255?
7. What are the different types of modes in 8255?
8. What are the features of mode 0 in 8255?
9. What are the features of mode 1 in 8255?
10. What are the features of mode 2 in 8255?
RESULT:
AIM:
To write and execute an assembly language program to convert an analog signal into a
digital signal using an ADC interfacing.
APPARATUS REQUIRED:
1. 8086 microprocessor kit/MASM ----1
2. ADC Interface board ----1
4. Power card ----1
5. Keyboard ----1
6. PC with Intel/AMD Processor----1
ALGORITHM:
(i) Select the channel and latch the address.
(ii) Send the start conversion pulse.
(iii) Read EOC signal.
(iv) If EOC = 1 continue else go to step (iii)
(v) Read the digital output.
(vi) Store it in a memory location.
PROGRAM:
RESULT:
Thus the ADC was interfaced with 8086 and the given analog inputs were converted into its digital
equivalent.
EXP. NO: 13B INTERFACING DIGITAL TO ANALOG CONVERTER
AIM:
To write and execute an assembly language program for digital to analog conversion.
APPARATUS REQUIRED:
1. 8086 microprocessor kit/MASM ----1
2. DAC Interface board ----1
3. Power card ----1
4. Keyboard ----1
5. PC with Intel/AMD Processor----1
ALGORITHM:
Square Waveform:
(i) Send low value (00) to the DAC.
(ii) Introduce suitable delay.
(iii) Send high value to DAC.
(iv)Introduce delay.
(v) Repeat the above procedure.
Saw-tooth waveform:
(i) Load low value (00) to accumulator.
(ii) Send this value to DAC.
(iii) Increment the accumulator.
(iv)Repeat step (ii) and (iii) until accumulator value reaches FF.
(v) Repeat the above procedure from step 1.
Triangular waveform:
(i) Load the low value (00) in accumulator.
(ii) Send this accumulator content to DAC.
(iii) Increment the accumulator.
(iv) Repeat step 2 and 3 until the accumulator reaches FF,
decrement the accumulator and send the accumulator contents
to DAC.
(v) Decrementing and sending the accumulator contents to DAC.
(vi)The above procedure is repeated from step (i)
OUTPUT:
WAVEFORM GENERATION
WAVEFORMS AMPLITUDE TIME PERIOD
Square wave 10v 1ms
Saw-tooth wave 10v 1.4ms
Triangular wave 10v 3.2ms
VIVA QUESTIONS:
1. What are the different types of ADC?
2. What is meant by conversion time?
3. What are the different types of ADC techniques available?
4. Name the ADC IC available using serial interface technique?
5. Name the ADC IC available using parallel interface technique?
6. What are the different types of DAC techniques available?
7. Name the DAC IC available
8. What is resolution?
9. What is settling time?
10. What is range of operation in DAC?
RESULT:
Thus the DAC was interfaced with 8086 and different waveforms have been generated
8051 MICROCONTROLLER
EXP. NO: 14A ARITHMETIC OPERATIONS USING 8051
AIM:
To write and execute an assembly language program for Add, subtract, multiply and division
of two 8-bit numbers using 8051.
APPARATUS:
1. 8051 microcontroller kit ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Load the First Data in A-register.
2. Load the Second Data in B-register.
3. Add the two data with carry.
4. Store the sum in memory location.
5. Stop the program.
PROGRAM:
OUTPUT:
INPUT OUTPUT
Register Data Address Data
A-register 02H 4500 06H
B-register 04H
SUBTRACTION
ALGORITHM:
1. Load the First Data in A-register.
2. Load the Second Data in B-register.
3. Subtract the two data with borrow.
4. Store the sum in memory location.
5. Stop the program.
PROGRAM:
OUTPUT:
INPUT OUTPUT
Register Data Address Data
A-register 05H 4500 04H
B-register 01H
MULTIPLICATION
ALGORITHM:
1. Get the multiplier in the accumulator.
2. Get the multiplicand in the B register.
3. Multiply A with B.
4. Store the product in memory location.
5. Stop the program.
PROGRAM:
OUTPUT:
INPUT OUTPUT
REGISTER DATA ADDRESS DATA
A 5 4500 19H
B 5
DIVISION
ALGORITHM:
1. Get the Dividend in the accumulator.
2. Get the Divisor in the B register.
3. Divide A by B.
4. Store the Quotient and Remainder in memory.
5. Stop the program.
PROGRAM:
OUTPUT:
INPUT OUTPUT
REGISTER DATA ADDRESS DATA
A-Register 05 4500 01(quotient)
B-Register 03 4501 02(remainder)
RESULT:
Thus an assembly language program for Division of two 8-bit numbers and 16-bit
numbers using 8051 was performed and its output was verified.
EXP. NO: 14B LOGICAL OPERATIONS USING 8051
AIM:
To write and execute an assembly language program to perform logical operations using 8051.
APPARATUS:
1. 8051 microcontroller kit ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Get the Data 1 in the R0-register.
2. Get the Data 2 in the A register.
3. Logical AND, OR, XOR A with R0.
4. Store the result in memory.
5. Stop the program.
OUTPUT:
INPUT OUTPUT
REGISTER DATA ADDRESS DATA
R0-Register 14 4500 10
A-Register 12
PROGRAM: OR OPERATION
INPUT OUTPUT
REGISTER DATA ADDRESS DATA
R0-Register 14 4500 16
A-Register 12
OUTPUT:
INPUT OUTPUT
REGISTER DATA ADDRESS DATA
R0-Register 14 4500 06
A-Register 12
VIVA QUESTIONS:
RESULT:
Thus an assembly language program for logical operations using 8051 was performed and
its output was verified.
EXP. NO: 15 SQUARE OF A NUMBER USING 8051
AIM:
To write and execute an assembly language program to find the square, cube and
2‟s complement of a number using 8051.
APPARATUS:
1. 8051 microcontroller kit ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Get the Data in the R0-register.
2. Get the same Data in the B register.
3. Multiply A and B.
4. Store the result in memory.
5. Stop the program.
PROGRAM:
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 FF 4201 01
4202 FE
CUBE OF A NUMBER USING 8051 : ALGORITHM:
1. Get the Data in the R0-register.
2. Get the same Data in the B register.
3. Multiply A and B.
4. Store the result in memory.
5. Stop the program.
PROGRAM:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 56 4201 98
4202 B4
4203 09
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
0B
4200 05 4201 H
VIVA QUESTIONS
1. Give the format of PSW register of 8051.
2. What is the use of PCON register?
3. Give the interrupt priorities of 8051.
4. What is the significance of DPTR?
5. Draw the format of TMOD register of 8051
6. List the modes of Timer in 8051.
7. Draw the format of TCON register of 8051
8. Draw the format of IE register.
9. Draw the format of IP register
10. Draw the format of SCON register of 8051
RESULT:Thus an assembly language program to find square, cube and 2‟s complement of a
number using 8051 was performed and its output was verified.
EXP. NO: 16 UNPACKED BCD TO ASCII USING 8051
AIM:
To write and execute an assembly language program to convert unpacked BCD to ASCII using
8051.
APPARATUS:
1. 8051 microcontroller kit ----1
2. Power card ----1
3. Keyboard ----1
4. PC with Intel/AMD Processor----1
ALGORITHM:
1. Get the Data in the R0-register.
2. Get the same Data in the B register.
3. Multiply A and B.
4. Store the result in memory.
5. Stop the program.
PROGRAM:
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 29 4201 39
4202 32
VIVA QUESTIONS:
RESULT:
AIM:
Write ALP Program to perform multi byte addition
APPARATUS:
8086 with keyboard interrupt kit module.
PROCEDURE:
1. Make the power supply connections from 4-way power mate connector on the
ALSNIFC-09 board. +5V -blue wire Ground -black wire
2. Connect 26-pin flat cable from interface module to P1 of the trainer kit.
3. Enter the program in the RAM location in 9000 and execute the program GO
<STARTING ADDRESS><EXEC>
PROGRAM
MEMORY OPCODE LABEL MEMONICS
LOCATION