Disha Karnataki
Full Member level 5
this is the code in asm written
i.e the code written here is: it will display 55h & aah with some delay in between them on port1 & a timer is set. So when timer interrupts there will isr execution. here is the code:
org 0000h
ljmp main
org 000bh //start of isr
clr tf0
lcall delay
mov p1,#00h
lcall delay
mov p1,#88h
reti
org 0030h
main:
mov p1,#00h
mov tmod,#01h //timer initialisation
mov ie,#82h //interrupt initialization
up:mov p1,#055h //
lcall delay //
lcall delay // displaying 55h, aah with some delay
mov p1,#0aah //
lcall delay //
setb tr0 //starts the timer
sjmp up
delay:mov r0,#0f0h
l1:mov r0,#0ffh //creating some delay
k1:djnz r0,k1
djnz r1,l1
ret
end
explaination :initailly before timer interrupts there is continuous display of 55h & aah on port p1 and when timer interrupts then in isr routine 00h & 88h is displayed.
problem facing: here the timer interrupt is not at all ending it is not coming out of the isr routine inspite of writing RETI(it is an instruction to written from interrupt) only once it is executing the main program & then it is ending up in isr routine & is not terminating at all.
please help.
i.e the code written here is: it will display 55h & aah with some delay in between them on port1 & a timer is set. So when timer interrupts there will isr execution. here is the code:
org 0000h
ljmp main
org 000bh //start of isr
clr tf0
lcall delay
mov p1,#00h
lcall delay
mov p1,#88h
reti
org 0030h
main:
mov p1,#00h
mov tmod,#01h //timer initialisation
mov ie,#82h //interrupt initialization
up:mov p1,#055h //
lcall delay //
lcall delay // displaying 55h, aah with some delay
mov p1,#0aah //
lcall delay //
setb tr0 //starts the timer
sjmp up
delay:mov r0,#0f0h
l1:mov r0,#0ffh //creating some delay
k1:djnz r0,k1
djnz r1,l1
ret
end
explaination :initailly before timer interrupts there is continuous display of 55h & aah on port p1 and when timer interrupts then in isr routine 00h & 88h is displayed.
problem facing: here the timer interrupt is not at all ending it is not coming out of the isr routine inspite of writing RETI(it is an instruction to written from interrupt) only once it is executing the main program & then it is ending up in isr routine & is not terminating at all.
please help.