interrupt programming doubt

Status
Not open for further replies.
Just curious, how did that compile without an error.

Mike.
No idea. Jimmy told me the 4th digit was not working so I looked at the code. I did not expect to find a problem.
 
hey all ,
am working with pic 16f876a. The compiler am using is HI tec c . I used to call a function from interrupt routine which is declared as extern . then it show a error ie multiple call graph . I fixed it with these commands #if OSCOMPILER==OSHT_PICC&&OSCALL_OSSIGNALXYZ==OSFROM_ANYWHERE. Now it is able to compile but when the interrupt occur it remains in the interrupt location only, not retuning but the interrupt flag get high according to interrupt setting. plz help me i will be very thankfull for you

thomas
 
If you call a function from your interrupt and the main code then there is a good chance it will crash as the variables get corrupted. It's normally better to set a flag in the interrupt, then check it in the main code and when set call the function.

If you're still stuck with this then you need to post code if you expect anyone to be able to help.

Mike.
 
hi mike,
Thanks for the reply. ma program is like tat their is no function call from the main line . while the interrupt uses the function for that am using a flag . but ma problem is once the interrupt occurred , it will not returning from the interrupt location.The point is no interrupt flag is high . i will post ma code soon.

thomas
 
hi guys,
While putting some values to option register, timer0 interrupt flag is getting high. am using pic 16f876a and the flag is not getting cleared. using hi tec compiler.plz help me

thanks & regards
thomasplam
 
Last edited:
The timer0 interrupt flag will always go high as it is always counting. If you want it to interrupt then set TMR0IE and clear TMR0IF in the interrupt.

Mike.
 
The timer0 interrupt flag will always go high as it is always counting. If you want it to interrupt then set TMR0IE and clear TMR0IF in the interrupt.

Mike.

hi mike,
ya interrupt enable is set, but the problem is TMR0IF is not getting cleared so its remains int the interrupt location only.Thanks for reply mike.

regards & thanks
thomasplam
 
Either you aren't clearing it in the interrupt or the interrupt is taking longer than the timer period. Without seeing the code it is almost impossible to advise what to do.

Mike.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…