You are on page 1of 27

INDEX

S.No.

Name of the Experiment

Date

Remarks

EXPERIMENT NO. 1
AIM: To show addition of two numbers.
Program:
MOV A, #05h
MOV B, #03h
ADD A,B
MOV P1,A
Hex file:
0000 7405
0002 75F003
0005 25F0
0007 F590

EXPERIMENT NO. 2
AIM: To subtract two numbers.
Program:
ORG 00H
MOV A, #05H
SUBB A, #02H
MOV P1, A
Hex file:
0000 7405
0002 9402
0004 F590

EXPERIMENT NO. 3
AIM: To multiply two numbers.
Program:
MOV A, #01h
MOV B, #02h
MUL AB
MOV P1, A

Hex file:
0000 7401
0002 75F002
0005 A4
0006 F590

EXPERIMENT NO. 4

AIM: To divide two numbers.


Program:
MOV A, #02h
MOV B, #02h
DIV AB
MOV P1, A

Hex file:
0000 7402
0002 75F002
0005 84
0006 F590

EXPERIMENT NO. 5

AIM : To write a program to generate a frequency of 100khz


Program:
MOV TMOD, #01H
HERE: MOV TL0, #FEH
MOV TH0, #FFH
CPL P1.2
ACALL DELAY
SJMP HERE
DELAY: MOV TCON, #10H
AGAIN: JNB TCON.5, AGAIN
CLR TCON.4
CLR TCON.5
RET

Symbol table:
HERE

Hex file:

0003 DELAY

0000 758901
0003 758AFE

000F AGAIN

0012

0006 758CFF
0009 B292
000B 110F
000D 80F4
000F 758810
0012 308DFD
0015 C28C
0017 C28D
0019 80E8

EXPERIMENT NO. 6

Aim: To generate a pulse width of 5ms.


Program:
ORG 00H
SETB P0.1
ACALL DELAY
CLR P0.1
END
DELAY: MOV R2, #19
HERE : MOV R3, #255
AGAIN : DJNZ R3, AGAIN
DJNZ R2, HERE
RET

CALCULATIONS:
For 22MHZ clock, machine cycle is of 0.546s
(2*255) * 0.546
278s
278*19 = 5.29ms

EXPERIMENT NO. 7

AIM: To write a program to receive a data which has been sent in serial
form and send it out to ports in parallel form and store it to RAM
location 60h.
Program:
ORG 0000H
MOV TMOD, #20H
MOV THI, #30H
MOV SCON, # 50H
SET B TR1
CLR RI
RPT: JNB RI, RPT
MOV A, SBUF
MOV P0, A
MOV 60H, A
MOV P1, A

OUTPUT: SERIAL TO PARALLEL

EXPERIMENT NO. 8

AIM: To write a program emulating traffic light controller.


Program:
CLR P0.1
CLR P0.2
CLR P0.3
CPL P1.5
MOV TMOD, #01H
DELAY: MOV TH0, #20H
MOV TH0, #0FFH
MOV TR1, #20H
HERE: JNB TF1, HERE
MOV TR1, #00H
CPL P0.5
SJMP DELAY
SETB P0.1
ACALL DELAY
CLR P0.1
SETB P0.2
CALL DELAY
CLR P0.2
SETB P0.3
ACALL DELAY
CLR P0.3
SYMBOL TABLE:
DELAY

000B HERE

0014

Hex file:
0000 C281
0002 C282
0004 C283
0006 B295
0008 758901
000B 758C20
000E 758CFF
0011 750D20
0014 300DFD
0017 750D00
001A B285
001C 80ED
001E D281
0020 110B
0022 C281
0024 D282
0026 110B
0028 C282
002A D283
002C 110B
002E C283

EXPERIMENT NO 9
AIM: To write a program to take in data through ports 0 and 1
one
after another and transfer this data serially,
continuously at baud rate 4800
Program:
MOV TMOD, #20H
MOV TH1, #-6
MOV SCON, #50H
MOV P0, #0FFH
MOV P1, #0FFH
MOV P2, #0FFH
SETB TCON.6
RPT: MOV A, P0
ACALL SEND
MOV A, P1
ACALL SEND
MOV A, P2
ACALL SEND
SJMP HERE
SEND: MOV SBUF,
A
HERE: JNB SCON.1, HERE
CLR SCON.1
RET
SYMBOL TABLE:
RPT

0014 SEND

0022 HERE

0024

Hex file:

0000 758920
0003 758DFA
0006 759850
0009 7580FF
000C 7590FF
000F 75A0FF
0012 D28E
0014 E580
0016 1122
0018 E590
001A 1122
001C E5A0
001E 1122
0020 8002
0022 F599
0024 3099FD
0027 C299
0029 22

OUTPUT: PARALLEL TO SERIAL

EXPERIMENT NO 10

AIM: To print numbers on seven segment display


Program:
MOV A, #0FCH
MOV P1, A
ACALL DELAY
MOV A, #60H
MOV P1, A
ACALL DELAY
MOV A, #0DAH
MOV P1, A
ACALL DELAY
MOV A, #0F2H
MOV P1, A
ACALL DELAY
MOV A, #66H
MOV P1, A
ACALL DELAY
MOV A, #0B6H
MOV P1, A
ACALL DELAY
MOV A, #0BEH
MOV P1, A
ACALL DELAY
MOV A, #0E0H
MOV P1, A
ACALL DELAY
MOV A, #0FEH
MOV P1, A
ACALL DELAY
MOV A, #0EEH

MOV P1, A
ACALL DELAY
DELAY:
MOV R2, #0AH

L1: DJNZ R2,L1


RET
SYMBOL TABLE:
Delay
003C l1

Hex file:

0000 74FC
0002 F590
0004 113C
0006
0008 F590
000A 113C
000C 74DA
000E F590
0010 113C
0012 74F2
0014 F590
0016 113C
0018 7466
001A F590
001C 113C

003E

001E 74B6
0020 F590
0022 113C
0024 74BE
0026 F590
0028 113C
002A 74E0
002C F590
002E 113C
0030 74FE
0032 F590
0034 113C
0036 74EE
0038 F590
003A 113C
003C 7A0A
003E DAFE
0040 22

EXPERIMENT NO 11
AIM: To display alphabet Y on LCD.

Program:
MOV A,#38H
ACALL COMMAND
MOV A,#0EH
ACALL COMMAND
MOV A,#01H
ACALL COMMAND
MOV A,#06H
ACALL COMMAND
MOV A,#86H
ACALL COMMAND
MOV A,#'Y'
ACALL DATA_DISPLAY
HERE: SJMP HERE
COMMAND: ACALL READY
MOV P1, A
CLR P3.0
CLR P3.1
SETB P3.2
CLR P3.2
RET
DATA_DISPLAY: ACALL READY
MOV P1,A
SETB P3.0
CLR P3.1
SETB P3.2
ACALL DELAY
CLR P3.2
RET
READY:
BACK:

SETB P1.7
CLR P3.0
SETB P3.1
CLR P3.2
ACALL DELAY
SETB P3.2
JB P1.7,BACK

RET
DELAY:
RET

MOV R0,#255
HERE1: DJNZ R0,HERE1

Hex file:
0000 7438
0002 111A
0004 740E
0006 111A
0008 7401
000A 111A
000C 7406
000E 111A
0010 7486
0012 111A
0014 7459
0016 1127
0018 80FE
001A 1136
001C F590
001E C2B0
0020 C2B1
0022 D2B2
0024 C2B2
0026 22
0027 1136
0029 F590
002B D2B0
002D C2B1
002F D2B2
0031 1146
0033 C2B2
0035 22
0036 D297
0038 C2B0
003A D2B1
003C C2B2
003E 1146
0040 D2B2
0042 2097F7
0045 22

0046 78FF
0048 D8FE
004A 22

SYMBOL TABLE :
HERE
0036
BACK

0018 COMMAND
003C DELAY

OUTPUT: LCD

001A DATA_DISPLAY 0027 READY


0046 HERE1

0048

OUTPUT: ADD

OUTPUT: SUB

OUTPUT: MUL

OUTPUT: DIV