Professional Documents
Culture Documents
Microprocessor & Microcontroller: (Assignment Report)
Microprocessor & Microcontroller: (Assignment Report)
Microprocessor & Microcontroller: (Assignment Report)
(Assignment Report)
P2
Name:
Abdul Nouman, Moeen Riaz ,Zain Ali
ID No:
170914 , 170911, 170899
Class/Sec:
BEEP(B)
Instructor’s Remarks:
Code:
org 00h
setb p1.0
main:
label1:
jnb p1.0,labela
mov P2,#40h
MOV a,#40h
call delay
label2:
jnb p1.0,labelb
mov P2,#4fh
MOV a,#4FH
call delay
label3:
jnb p1.0,labelc
mov P2,#24h
MOV a,#24H
call delay
label4:
jnb p1.0,labeld
mov P2,#30h
MOV a,#30H
call delay
label5:
jnb p1.0,labele
mov P2,#19h
MOV a,#19H
call delay
label6:
jnb p1.0,labelf
mov P2,#12h
MOV a,#12h
call delay
label7:
jnb p1.0,labelg
mov P2,#02h
MOV a,#02H
call delay
label8:
jnb p1.0,labelh
mov P2,#78h
MOV a,#78H
call delay
label9:
jnb p1.0,labeli
mov P2,#00h
MOV a,#00H
call delay
jmp main
buttonpressed:
labela:
jb p1.0,blink1
mov P2,#40h
MOV a,#40h
call delay
labelb:
jb p1.0,blink1
mov P2,#4fh
MOV a,#4FH
call delay
labelc:
jb p1.0,blink1
mov P2,#24h
MOV a,#24H
call delay
labeld:
jb p1.0,blink1
mov P2,#30h
MOV a,#30H
call delay
labele:
jb p1.0,blink1
mov P2,#19h
MOV a,#19H
call delay
labelf:
jb p1.0,blink1
mov P2,#12h
MOV a,#12H
call delay
labelg:
jb p1.0,blink1
mov P2,#02h
MOV a,#02H
call delay
labelh:
jb p1.0,blink1
mov P2,#78h
MOV a,#78H
call delay
labeli:
jb p1.0,blink1
mov P2,#00h
MOV a,#00H
call delay
jmp buttonpressed
blink1:
jnb P1.0,blink2
mov P2,#7fh
call delay
mov P2,a
call delay
jmp blink1
blink2:
jb P1.0,check
mov P2,#7fh
call delay
mov P2,a
call delay
jmp blink2
check:
cjne a,#40H,loop1
jmp label1
loop1:
cjne a,#4fh,loop2
jmp label2
loop2:
cjne a,#24h,loop3
jmp label3
loop3:
cjne a,#30h,loop4
jmp label4
loop4:
cjne a,#19h,loop5
jmp label5
loop5:
cjne a,#12h,loop6
jmp label6
loop6:
cjne a,#02h,loop7
jmp label7
loop7:
cjne a,#78h,loop8
jmp label8
loop8:
cjne a,#00h,qq
jmp label9
qq:
ret
delay:
mov R2,#6
l3:
mov R0,#200
l1:
mov R1,#200
l2:
djnz R1,l2
djnz R0,l1
djnz R2,l3
ret
end
Proteus pictures:
COMPARISON WALA :
Code:
org 00h
main:
mov a,p0
mov 2fh,p1
cjne a,2fh,nowcompare
mov p2,#06h
jmp main
nowcompare:
jc less
jnc greater
less:
mov p2,#12h
jmp main
greater:
mov p2,#10h
jmp main
end
Proteus pictures:
equal condition:
When small
When greater: