PDA

View Full Version : Timer2 Interrupt, 16F1823



Dick Ivers
- 5th January 2013, 02:05
I'm using a Timer2 interrupt on the timer's value match to PR2. I would like to enable/disable the interrupt function during the course of my program. Is it better to enable/disable using global interrupt enable GIE (INTCON bit 7) or timer 2 interrupt enable TMR2IE (PIE1 bit1)?

HenrikOlsson
- 5th January 2013, 08:46
If you also have other interrupt sources then clearing the GIE-bit will of course disable them too. Clearing TMR2IE will disable that interrupt only. If you're using DT-INTS then you can use @ INT_DISABLE TMR2_INT.

/Henrik.

Dick Ivers
- 5th January 2013, 20:12
Henrick,
Clearing TMR2IE is working .. just tried it. I only have one interrupt source so clearing GIE would probably also work. I'm not using DT_INT, not needed with the 16F1823 family.

HenrikOlsson
- 5th January 2013, 22:29
Great!
So you're writing the interrupt service routine all in ASM then? Well that's is indeed the best way but also the hardest - at least for me, because I suck at it :-(

/Henrik.

Antorbd04
- 2nd April 2014, 19:23
How to setup Timer2 interrupt????????

Demon
- 2nd April 2014, 23:55
16F PICs:
http://www.darreltaylor.com/DT_INTS-14/intro.html

18F PICs:
http://darreltaylor.com/DT_INTS-18/home.html

Then search the forums for examples.

Robert