All about interrupts

I need to know how to set up an interrupt in C for microcontrollers.

Also, is it possible to have an interrupt in C++ without a microcontroller? For example, run the interrupt function whenever the user hits enter.

I know that this is pretty broad, but any information is welcome.

Thanks for your replies!
Unfortunately, I'm pretty sure microcontroller interrupt subroutines are handled differently on a
compiler-to-compiler basis. As an example, on the PCW compiler, the following interrupt
subroutine will increment overflow every time the Timer1 interrput is triggered:

1
2
3
4
5
#int_timer1
void timer1_isr(){
   overflow++;
}


the preprocessor command identifies this function as the one associated with the Timer1 interrupt.

You will probably also need to adjust the registers associated with whatever interrupts you
will be using. The register addresses should be easy to find in the microcontroller datasheet.

I hope this offers some help. As far as using interrupts on a computer platform, that question
will need to be fielded by a more savvy programmer than myself.

Last edited on
Topic archived. No new replies allowed.