interrupt

Status
Not open for further replies.
im using pic 16f877a for my project....i want to use interrupt in it...i heard that i shouldnt make isr much long and should avoid calling subroutines like delay loops within isr.....is there some relevance to the statement....im currently facing some delay as i exit the isr which is not intended...how can i avoid it?....should i make interrupt routine small.....also can i call interrupt when im in the isr by clearing the interrupt bits...........


i hope some one ll b having a gud answer.....
 
Yes, make it as small and fast as you can, and don't call any subroutines from within it. Make sure you save and restore all required registers.
 
so can i make a table within the isr and call subroutines which are defined inside isr.....?

how can i do things without calling even delay loops....i need delay to make the motors respond accurately......how can i do it......?
 
im attaching my code ......
i found that its taking much time to exit the isr when i simulated it....is the clearing of the flag i have done proper.....should the external interrupt flag be cleared within the isr........can i call subroutines as i have done which are inside the isr?
 

Attachments

  • program.txt
    9.9 KB · Views: 153
Last edited:
inrstdinrobotics said:
so can i make a table within the isr and call subroutines which are defined inside isr.....?

how can i do things without calling even delay loops....i need delay to make the motors respond accurately......how can i do it......?

The usual method is to use the ISR just to set flags, the main program loop then checks the flags and branches accordingly.

Your code is very confusing, as you're using numbers for registers and bits, use their names instead as defined in the include file.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…