0% found this document useful (0 votes)
44 views4 pages

Es Programs

The document contains 10 programs written in assembly language. Program 1 adds three numbers and stores the result in the accumulator. Program 2 adds the values from 0 to 10 and stores the sum in the accumulator. Program 3 generates a 50Hz signal on port 1.2 by using Timer 0. Program 4 finds the frequency of a signal on port 1.2 by using Timer 1. Program 5 toggles port 0.4 every 1 second by using Timer 1. Program 6 generates a 50% duty cycle signal on port 1.0 by using Timer 0. Program 7 generates an interrupt on port 1.3 by using the INT1 interrupt. Program 8 continuously transmits the message "JERRY" through the serial port. Program 9

Uploaded by

John
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views4 pages

Es Programs

The document contains 10 programs written in assembly language. Program 1 adds three numbers and stores the result in the accumulator. Program 2 adds the values from 0 to 10 and stores the sum in the accumulator. Program 3 generates a 50Hz signal on port 1.2 by using Timer 0. Program 4 finds the frequency of a signal on port 1.2 by using Timer 1. Program 5 toggles port 0.4 every 1 second by using Timer 1. Program 6 generates a 50% duty cycle signal on port 1.0 by using Timer 0. Program 7 generates an interrupt on port 1.3 by using the INT1 interrupt. Program 8 continuously transmits the message "JERRY" through the serial port. Program 9

Uploaded by

John
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

PROGRAM 1(ADD)

Org 0h
MOV R5, #29H
MOV R7, #45H
MOV A, #0H
ADD A, R5
ADD A, R7
ADD A, #48H
HERE: SJMP HERE
END

PROGRAM 2(ADD 10)


Org 0h
MOV R0, #10H
MOV R1, #0H
MOV A, #00H
AGAIN: INC R1
ADD A, R1
DJNZ R2, AGAIN
END

PROGRAM 3(50 HZ)


ORG 0000H
LJMP MAIN
ORG 000BH
CPL P1.2
MOV TL0, #0000H
MOV TH0, #0DCH
RETI
ORG 00030H
MAIN:
MOV TMOD, #01H
MOV TL0, #00H
MOV TH0, #0DCH
MOV IE, #82H
SETB TR0
HERE: SJMP HERE
END
PROGRAM 4 (FIND FREQUENCY)
ORG 0000H
MOV TMOD, #20H
MOV TH1, #5H
SETB TR1
BACK: JNB TF1, BACK
CPL P1.2
CLR TF1
SJMP BACK
END

PROGRAM 5 (1 MHZ)
ORG 0000H
REPEAT: MOV TMOD, #0H
MOV R0, #10H
AGAIN: MOV TL1, #0B0H
MOV TH1, #3CH
SETB TR1
HERE: JNB TF1, HERE
CLR TR1
CLR TF1
DJNZ R0, AGAIN
CPL P0.4
SJMP REPEAT
END

PROGRAM 6 (50% DUTYCYCLE)


HERE: MOV TL0, #0F2H
MOV TH0, #0FFH
CPL P1.0
ACALL DELAY
ACALL DELAY
SJMP HERE
DELAY: SETB TR0
AGAIN: JNB TF0, AGAIN
CLR TR0
CLR TF0
RET
END
PROGRAM 7 (INT1)
ORG 0000H
LJMP MAIN
ORG 0013H
CLR P1.3
ACALL DELAY
ACALL DELAY
ACALL DELAY
SETB P1.3
RETI
ORG 0030H
MAIN: MOV IE, #10000100
HERE: SJMP HERE
DELAY: MOV R1, #255
MOV R2, #255
LOOP: DJNZ R2, $
DJNZ R1, LOOP
RET
END

PROGRAM 8 (SERIAL MESSAGE)


ORG 0000H
MOV TMOD, #20H
MOV TH1, #-3
MOV SCON, #50H
SETB TR1
AGAIN: MOV A, #'J'
ACALL Trans
MOV A, #'E'
ACALL Trans
MOV A, #'R'
ACALL Trans
MOV A, #'R'
ACALL Trans
MOV A, #'Y'
ACALL Trans
SJMP AGAIN
Trans: MOV SBUF, A
HERE: JNB TI, HERE
CLR TI
RET
END
PROGRAM 9 (LARGEST IN ARRAY)
ORG 0000H
MOV R0, #50H
MOV R1, #10H
MOV B, #00H
BACK: MOV A, @R0
CJNE A, B, LOOP
LOOP: JC LOOP1
MOV B, A
INC R0
DJNZ R1, BACK
LOOP1: INC R0
DJNZ R1, BACK
END

PROGRAM 10 (1s AND 0s)


ORG 000H
MOV A, #29H
MOV R0, #00H
MOV R1, #00H
MOV R2, #08H
LOOP1: RLC A
JNC DOWN
INC R0
DOWN: DJNZ R2, LOOP1
MOV A, #08H
CLR C
SUBB A, R0
MOV R1, A
HERE: SJMP HERE
END

You might also like