reloading program
Thu Dec 20 2007, 11:20 pm
Hi,
I'm new to the 8051 and was trying to figure out how to reload a program after an interrupt.
Basically, I got a program that displays something on lcd, once an interrupt is activated, it displays a different message. But once the interrupt is cleared, the interrupted message is still there. I want it to revert back to the original message once interrupt clears. How do I do that?
Please give code example and explain.
Thank you,
I'm new to the 8051 and was trying to figure out how to reload a program after an interrupt.
Basically, I got a program that displays something on lcd, once an interrupt is activated, it displays a different message. But once the interrupt is cleared, the interrupted message is still there. I want it to revert back to the original message once interrupt clears. How do I do that?
Please give code example and explain.
Thank you,
Thu Dec 20 2007, 11:27 pm
wat u mean by program reload..?
u can make two methods like
u can make two methods like
activeInterrupt() { showMsg("xyz"); } noInterrupt() { showMsg("abc"); }:-|
Thu Dec 20 2007, 11:30 pm
Is that in C? I need to do i tin Assembly.
Need it to say hello if not activate and bye when activated and go back to hello once interrupt is deactivated.
Here is my code:
Here's my example program, please make correction to it:
Need it to say hello if not activate and bye when activated and go back to hello once interrupt is deactivated.
Here is my code:
Here's my example program, please make correction to it:
org 0h LJMP MAIN ;ISR for Interrup INT 0 for Part 2: ORG 0013H Mov a, #38H acall command acall delay Mov a, # 0EH acall command acall delay Mov a, # 01H acall command acall delay Mov a, # 06H acall command acall delay Mov a, # 80H acall command Mov a, # 'B' acall datadisplay acall delay Mov a, # 'Y' acall datadisplay acall delay Mov a, # 'E' acall datadisplay acall delay hold: sjmp hold reti MAIN: Mov a, #38H acall command acall delay Mov a, # 0EH acall command acall delay Mov a, # 01H acall command acall delay Mov a, # 06H acall command acall delay Mov a, # 80H acall command acall delay Mov a, # 'H' acall datadisplay acall delay Mov a, # 'E' acall datadisplay acall delay Mov a, # 'L' acall datadisplay acall delay Mov a, # 'L' acall datadisplay acall delay Mov a, # 'O' acall datadisplay acall delay Mov IE,#10000101B stay: sjmp stay delay: mov r3, #50 here2: mov r4,#255 here: djnz r4, here djnz r3, here2 ret command: ;to use in LCD mov p1,a clr p2.0 ;make RS 0 to execute command code on LCD clr p2.1 ;make R/W 0 for writing setb p2.2 acall delay clr p2.2 ret datadisplay: ;to display data on LCD mov p1,a setb p2.0 ;make RS 1 to execute data display on LCD clr p2.1 ;make R/W 0 for writing setb p2.2 ;high-to-low pulse to E pin of LCD acall delay clr p2.2 ret end
[ Edited Fri Dec 21 2007, 12:10 am ]
Thu Dec 20 2007, 11:41 pm
fyi,
I believe the correct quote is:
A journey of a thousand miles begins with a single step. by Confucius
I believe the correct quote is:
A journey of a thousand miles begins with a single step. by Confucius
Thu Dec 20 2007, 11:49 pm
hey shawn.....
thats no ConFUcious .. we dont know him....
we know Abbas so
"A Thousand Miles Journey Starts With a Single Step"
is the correct one
thats no ConFUcious .. we dont know him....
we know Abbas so
"A Thousand Miles Journey Starts With a Single Step"
is the correct one
Thu Dec 20 2007, 11:51 pm
fyi,
I believe the correct quote is:
A journey of a thousand miles begins with a single step. by Confuciusshawn
maybe....
but here semantics is more important than syntax .......:):):)
Fri Dec 21 2007, 12:07 am
I guess those who stand on toilets are high on pot!
back to subject,
any suggestion to make my program run like I want it to?
I've tried just about everything I know of, but can't seem to figure it out.
Any help would be appreciated,
Thanks!
back to subject,
any suggestion to make my program run like I want it to?
I've tried just about everything I know of, but can't seem to figure it out.
Any help would be appreciated,
Thanks!
Fri Dec 21 2007, 12:17 am
shawn .....
once the irq is over..............
the code returns back to.........
so u r not updating lcd..............
u wont get hello...........
so in the infinite loop call the programme to display again and it will be done
wht does that mean???
hope u r taking it lightly
once the irq is over..............
the code returns back to.........
stay: sjmp stay
so u r not updating lcd..............
u wont get hello...........
so in the infinite loop call the programme to display again and it will be done
I guess those who stand on toilets are high on pot!
wht does that mean???
hope u r taking it lightly
shawn like this.
Fri Dec 21 2007, 12:17 am
instead of using this statement..
create a status bit.. say "interrupted".
When interrupt occurs set the bit.. and when the bit is set jump to start of program..
so you can replace the above statement by this..
and make sure to clear this bit at the start of main routine and set it in the interrupt service routine.
stay: sjmp stay
create a status bit.. say "interrupted".
interrupted bit 0H
When interrupt occurs set the bit.. and when the bit is set jump to start of program..
so you can replace the above statement by this..
stay: jnb interrupted, stay sjmp main
and make sure to clear this bit at the start of main routine and set it in the interrupt service routine.
[ Edited Fri Dec 21 2007, 12:20 am ]
shawn like this.
Fri Dec 21 2007, 12:37 am
didn't work, all that did was repeat hello, but doesn't return to hello once deactivated.
Switched loop command into isr and working good.
Thanks guys!
Switched loop command into isr and working good.
Thanks guys!
Powered by e107 Forum System