I am using a PIC16LF18855. The project is a clock. To update the time I need an interrupt on timer1 and I also need an interrupt when the setting pin is pressed.
Up to now I have been polling the interrupt flag bits (PIR4.0 and PIR0.0) and it worked.
There was some slight problems with accuracy which may be overcome by having timer1 overflow go to an interrupt service routine. Problem is when I insert the line...
on interrupt timer1overflow call change
Now the interrupt pin for setting the time does not work (but the timer overflow works).
Is there anything obvious that I need to do to make this work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You would need to handle the interrupt by adding on interrupt onchange[whatever] call myISR or remove the on interrupt then handle all interrupts in the sub called interrupt.
So, either add the other on interrupt or handle the interrupts in a sub called interrupt.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. I will try that.
So once there is a "ON INTERRUPT" all other interrupts need to be handled with a ON INTERRUPT (you can no longer rely on the PIRx.0 bits to monitor when an interrupt has taken place.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But, post a few lines of code using that chip so I can review.
The two methods will always call the interrupt vector ( the interrupt subroutine ) and I do not think that specific bit would be changed as the compiler is not managing the state. But, you few lines of code will help me analyse.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using a PIC16LF18855. The project is a clock. To update the time I need an interrupt on timer1 and I also need an interrupt when the setting pin is pressed.
Up to now I have been polling the interrupt flag bits (PIR4.0 and PIR0.0) and it worked.
There was some slight problems with accuracy which may be overcome by having timer1 overflow go to an interrupt service routine. Problem is when I insert the line...
on interrupt timer1overflow call change
Now the interrupt pin for setting the time does not work (but the timer overflow works).
Is there anything obvious that I need to do to make this work.
You would need to handle the interrupt by adding
on interrupt onchange[whatever] call myISR
or remove theon interrupt
then handle all interrupts in the sub calledinterrupt
.So, either add the other on interrupt or handle the interrupts in a sub called interrupt.
Thanks. I will try that.
So once there is a "ON INTERRUPT" all other interrupts need to be handled with a ON INTERRUPT (you can no longer rely on the PIRx.0 bits to monitor when an interrupt has taken place.
I would think not.
But, post a few lines of code using that chip so I can review.
The two methods will always call the interrupt vector ( the interrupt subroutine ) and I do not think that specific bit would be changed as the compiler is not managing the state. But, you few lines of code will help me analyse.