Home 9 The Art of Technology 9 PIC10F322 XC8 Interrupts : Overview

PIC10F322 XC8 Interrupts – Here is a quick overview of how to get interrupts going in XC8.

You will need to define your interrupt function or handler in your code.

void __interrupt () isr_routine (void)
{
}

The name isr_routine can be anything you want, however __interrupt () is very important it tells XC8 that this function should be assigned to the interrupt jump point.

The interrupt function will need to clear the interrupt flag of the device that caused the interrupt. Failure to do so in code will result in a never ending interrupt.

In your setup – you will need to set the interrupt enable flag of the device you want to cause the interrupt, along with GIE, Global Interrupt Enable.

If you have multiple interrupts enabled. You will need to check the interrupt flags of the devices that are enabled to handle that specific interrupt.

In the next post I will go over with code enabling a timer0 interrupt to replace __delay_ms()


Have a Project or Idea!?

I am Available for Freelance Projects

I’m always ready to take on new opportunities and eager to connect with like-minded people.

If you’re interested in working together, connecting, or just having a good conversation, send me an email. I look forward to hearing from you!

jamie@jamiestarling.com


Pin It on Pinterest

Share This