Menu

interrupt problems

Help
2023-11-04
2023-11-05
  • David Stephenson

    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.

     
  • Anobium

    Anobium - 2023-11-04

    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.

     
  • David Stephenson

    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.

     
    • Anobium

      Anobium - 2023-11-05

      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.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.