Wednesday, January 6, 2010


In ECE 344 we learned about interrupts and how to use them, of course we were programming in assembly, so we had to setup our interrupt vector, then write some code at the appropriate offset.

That turned out to be pretty easy, but the problem is let's say we want to write some code in C and try to handle interrupts. This is a little tricky if you don't have all the information you need.

Well of course since I can't seem to think logically sometimes, I didn't look at any manuals and just headed over to, where I got some great answer's here: Interrupts

The simple answer was this:
void interrupt my_interrupt_handler (void) {
I did some testing and once I had the right bit's turned on I just ended up in my interrupt routine with this (about 90% borrowed from here:Microchipc):
void interrupt isr(void)
if (T0IF)
//code right here is executed every 800us

My newest project I'll be working on with this microcontroller is to find some way to create a simple serial interface which I can transmit and receive a piece of data. Since I can interrupt on a timed interval. I should be able to read data passed at an expected rate.

I'll keep you updated when I get more work done.