0% found this document useful (0 votes)
40 views

ES Cycle 1 Programs

The document contains 19 programs demonstrating various operations on 8051 microcontrollers like arithmetic operations, logical operations, data exchange between registers and memory locations, parity checking, seven segment display counting, etc. Each program is written in assembly language and contains the code, input and output. The programs are part of an embedded systems lab assignment submitted by a student.

Uploaded by

deccancollege
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)
40 views

ES Cycle 1 Programs

The document contains 19 programs demonstrating various operations on 8051 microcontrollers like arithmetic operations, logical operations, data exchange between registers and memory locations, parity checking, seven segment display counting, etc. Each program is written in assembly language and contains the code, input and output. The programs are part of an embedded systems lab assignment submitted by a student.

Uploaded by

deccancollege
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/ 19

DCET EMBEDDED SYSTEMS LAB

01. Program illustrating arithmetic operations

Program:

org 00
mov a,#5
mov r0,#2
add a,r0
mov r1,a
mov a,#10
subb a,r0
mov r2,a
mov b,#3
mul ab
mov r3,a
mov b,#2
div ab
mov r4,a
loop: sjmp loop
end

OUTPUT:

Name: SWATI LAL 1 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

02. Program illustrating logical operators

Program:

org 00
mov a,#02h
mov r0,#04h
anl a,r0
mov r1,a
mov 40h,#03h
mov 40h,#01h
mov r2,40h
cpl a
mov r3,a
loop: sjmp loop
end

OUTPUT:

Name: SWATI LAL 2 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

03. Program to exchange the data present at 40h address to 50h


address at bank_1

Program:

org 00
setb psw.3
clr psw.4
mov r0,#40h
mov @r0,#30h
mov a,@r0
mov r1,#50h
mov @r1,#45h
xch a,@r1
xch a,@r0
loop: sjmp loop
end

OUTPUT:

Name: SWATI LAL 3 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

04. Program to copy the data of r3 register of bank 1 to r4 register


of bank 2 after swapping the nibbles

Program:

org 00
setb psw.3
clr psw.4
mov r3,#43h
mov a,r3
swap a
mov b,a
clr psw.3
setb psw.4
mov r4,#44h
mov a,r4
swap a
mov r4,b
setb psw.3
clr psw.4
mov r3,a
loop: sjmp loop
end

OUTPUT:

Name: SWATI LAL 4 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

05. Program to exchange higher nibble of r5 register to lower nibble


of r6 register after complimenting the bits. The other nibbles of r5 &
r6 registers should not be changed

Program:

org 00
mov r5,#45h
mov r6,#64h
mov a,r5
swap a
mov @r1,a
mov a,r6
cpl a
xchd a,@r1
mov a,@r1
swap a
mov r5,a
mov a,r6
xchd a,@r1
mov r6,a
loop: sjmp loop
end

OUTPUT:

06. Program to check even parity

Name: SWATI LAL 5 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

Program:

org 00
mov r0,#00
mov a,#51
mov r7,a
mov r1,#08
loop1: clr psw.7
rlc a
jc loop2
sjmp loop3
loop2: inc r0
loop3: djnz r1,loop1
mov a,r0
mov b,#02
div ab
mov a,b
cjne a,#0,loop4
mov p0,r7
loop4: sjmp loop4
end

OUTPUT:

07. Program to covert even parity to odd parity

Name: SWATI LAL 6 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

Program:

org 00
mov r0,#00
mov a,#51
mov r7,a
mov r1,#08
loop1: clr psw.7
rlc a
jc loop2
sjmp loop3
loop2: inc r0
loop3: djnz r1,loop1
mov a,r0
mov b,#02
div ab
mov a,b
cjne a,#0,loop4
mov p0,r7
mov a,r7
rlc a
jc cmp1
sjmp cmp2
cmp1: clr psw.7
cmp2: setb psw.7
rrc a
mov p0,a
loop4: sjmp loop4
end

OUTPUT:

Name: SWATI LAL 7 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

Name: SWATI LAL 8 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

08. Program illustrating interfacing of LED to implement 8-bit


binary-up counter

Program:

org 00
loop: mov a,#00h
back: mov p0,a
acall delay
inc a
cjne a,#0ffh,back;
sjmp loop
delay: mov r3,#00h
loop1: mov r1,#00h
loop2: djnz r1,loop2
djnz r3,loop1
ret
end

OUTPUT:

Name: SWATI LAL 9 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

09. Program illustrating interfacing of LED to implement 8-bit


binary-down counter

Program:

org 00
loop: mov a,#0ffh
back: mov p0,a
acall delay
dec a
cjne a,#00h,back
sjmp loop
delay: mov r3,#0ffh
loop1: mov r1,#0ffh
loop2: djnz r1,loop2
djnz r3,loop1
ret
end

OUTPUT:

10. Program illustrating the implementation of a mod-4 counter

Name: SWATI LAL 10 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

Program:

org 00
mov r0,#00h
mov p0,r0
loop: acall delay
inc r0
mov a,r0
mov b,#4
div ab
mov p0,b
sjmp loop
delay: mov r3,#0efh
loop1: mov r1,#0efh
loop2: djnz r3,loop1
ret
end

OUTPUT:

11. Program illustrating the implementation of a mod-8 counter

Name: SWATI LAL 11 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

Program:

org 00
mov r0,#00h
mov p0,r0
loop: acall delay
inc r0
mov a,r0
mov b,#8
div ab
mov p0,b
sjmp loop
delay: mov r3,#0efh
loop1: mov r1,#0efh
loop2: djnz r1,loop2
djnz r3,loop1
ret
end

OUTPUT:

12. Program illustrating the implementation of a mod-10 counter

Name: SWATI LAL 12 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

Program:

org 00
mov r0,#00h
mov p0,r0
loop: acall delay
inc r0
mov a,r0
mov b,#10
div ab
mov p0,b
sjmp loop
delay: mov r3,#0efh
loop1: mov r1,#0efh
loop2: djnz r3,loop1
ret
end

OUTPUT:

13. Seven-Segment display to implement single-digit decimal-up


counter

Name: SWATI LAL 13 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

Program:

org 00
up: mov r0,#0ah
mov dptr,#200h
up1: clr a
movc a,@a+dptr
mov p0,a
dec r0
inc dptr
cjne r0,#0h,up1
sjmp up
delay: mov r3,#0ffh
loop1: mov r2,#0efh
loop2: djnz r2,loop2
djnz r3,loop1
ret
org 200h
db 0c0h,0f9h,0a4h,0b0h,099h,092h,082h,0f8h,080h,090h
end

OUTPUT:

14. Seven-Segment display to implement single-digit decimal-down


counter

Program:

Name: SWATI LAL 14 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

org 00
up: mov r0,#0ah
mov dptr,#200h
up1: clr a
movc a,@a+dptr
mov p0,a
dec r0
inc dptr
cjne r0,#0h,up1
sjmp up
delay: mov r3,#0ffh
loop1: mov r2,#0efh
loop2: djnz r2,loop2
djnz r3,loop1
ret
org 200h
db 090h,080h,0f8h,082h,092h,099h,0b0h,0a4h,0f9h,0c0h
end

OUTPUT:

15.Seven-Segment display to implement double-digit decimal-up


counter

Program:

Name: SWATI LAL 15 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

org 00
up: mov r0,#0ah
mov dptr,#200h
up1: clr a
movc a,@a+dptr
mov p0,a
mov r6,dph
inc dpl
mov r7,dpl
up2: mov r1,#0ah
mov dptr,#200h
up3: clr a
movc a,@a+dptr
mov p1,a
acall delay
dec r1
inc dptr
cjne r1,#0h,up3
mov dph,r6
mov dpl,r7
mov p1,#0c0h
sjmp up1
sjmp up2
dec r0
cjne r0,#0h,up1
delay: mov r3,#0ffh
loop1: mov r2,#0e0h
loop2: djnz r2,loop2
djnz r3,loop1
ret

org 200h
db 0c0h,0f9h,0a4h,0b0h,099h,092h,082h,0f8h,080h,090h
end

OUTPUT:

Name: SWATI LAL 16 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

16. Seven-Segment display to implement double-digit decimal-down


counter

Name: SWATI LAL 17 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

Program:

org 00
up: mov r0,#0ah
mov dptr,#200h
up1: clr a
movc a,@a+dptr
mov p0,a
acall delay
mov r6,dph
inc dpl
mov r7,dpl
up2: mov r1,#0ah
mov dptr,#200h
up3: clr a
movc a,@a+dptr
mov p1,a
acall delay
dec r1
inc dptr
cjne r1,#0h,up3
mov dph,r6
mov dpl,r7
mov p1,#0c0h
sjmp up1
sjmp up2
dec r0
inc dptr
cjne r0,#0h,up1
delay: mov r3,#0ffh
loop1: mov r2,#0e0h
loop2: djnz r2,loop2
djnz r3,loop1
ret
org 200h
db 090h,080h,0f8h,082h,092h,099h,0b0h,0a4h,0f9h,0c0h
end
OUTPUT:

Name: SWATI LAL 18 Roll No: 160311733091


DCET EMBEDDED SYSTEMS LAB

Name: SWATI LAL 19 Roll No: 160311733091

You might also like