chipKIT® Development Platform

Inspired by Arduino™

Timers and ISRs

Created Fri, 10 Jun 2011 09:28:33 +0000 by trandi


Fri, 10 Jun 2011 09:28:33 +0000

Another feature that I use quite a lot with the Arduino, is using the Atmega timers and interrupt vectors directly.

Something like this for the timers:

*TCCR1A = 0x00; TCCR1B = 1 << CS10; // NO pre-scaling TIMSK1 = 1 << TOIE1; //Timer1 Overflow Interrupt Enable *

OR this for the interrupt service routines.


I'm sure the PIC32 on the chipKIT boards has even more timers and supports interrupt routines, etc. ...

How easy it is to use them directly from the Multi Platform IDE ? Can we similarly mix lower level code with the Arduino specific one ? If yes, where is a good documentation about these 2 things: timers and ISRs ?

many thanks in advance, dan

Ar Druid O

Fri, 10 Jun 2011 15:26:16 +0000

I would also like to know this.

Probably it's just a case of looking at the data sheet for the timer info. Not sure how to do the inline assembly, tho- maybe someone could chime in here?


Fri, 10 Jun 2011 17:15:38 +0000

Here's the reply that I got from one of the Digilentinc guys:

" Hello Dan,

You can access the low level registers just as you would for the AVR chips, and you can mix and match just as with the Arduino IDE. If you wish to work with the hardware specific features of the PIC32 then the best place to get information is directly from the Microchip Datasheets for the PIC32MX795F512L (ChipKit MAX32) or the PIC32MX320F128H (ChipKit Uno32).

Good luck with your project, "

Hope this helps other people, dan

Ar Druid O

Fri, 10 Jun 2011 21:26:24 +0000

I found this book that might be helpful:

Programming 32 bit microcontrollers in C : Exploring the PIC 32 by Lucio di Jasio

The chapter on interrupts has some good example code.