Interrupt_low using Timers 0, 1 and 2.

General discussion on mikroC.
Post Reply
Author
Message
Angelli
Posts: 20
Joined: 19 Nov 2008 18:20

Interrupt_low using Timers 0, 1 and 2.

#1 Post by Angelli » 30 Sep 2010 18:55

Hi
You have programmed the Timer 0, 1 and 2 as Interrupt_low?
Can you help me or show me an example?
Will I have to work with these leading Timer interrupt.
Thank you for your attention!

Best Regards,

Anderson

User avatar
ranko.rankovic
Posts: 433
Joined: 11 Jun 2010 09:22

Re: Interrupt_low using Timers 0, 1 and 2.

#2 Post by ranko.rankovic » 01 Oct 2010 14:12

Hello Angelli,

What MCU type you have?

If you are looking for examples that are written for Timer0/1/2 Interrupt, they are located within examples provided with our software bundle (\Examples\Internal MCU modules\).

Also you can read under section Interrupts in our Help file little more about it.

Best regards
Ranko Rankovic
mikroElektronika [Support Department]

Angelli
Posts: 20
Joined: 19 Nov 2008 18:20

Re: Interrupt_low using Timers 0, 1 and 2.

#3 Post by Angelli » 01 Oct 2010 16:14

Dear Rankovic,
Thank you for your attention!
I am using the PIC18LF6722.
Noting examples can fix and better absorb the knowledge.
You can post a snippet of this configuration with Interrupt_low Timers?

Thanks!

Best regards.

Anderson Angelli.

womai
Posts: 239
Joined: 16 Apr 2008 07:45

Re: Interrupt_low using Timers 0, 1 and 2.

#4 Post by womai » 02 Oct 2010 04:35

Using the low priority interrupt on a PIC18F device works exactly the same as using the normal interrupt, with a few additions:

- enable interrupt priority bit (set it to 1)
- globally enable low priority interrupts (INTCON.GIEL = 1)
- set the interrupt priority bit of the interrupt in question (e.g. for timer0 the bit is called TMR0IP) to low (= 0)
- instead if void interrupt(), define a function called void interrupt_low()

So just take the existing timer interrupt example, add above changes (refer to the PIC data sheet, section "Interrupts", for the register names where these bits are located), and you should be up and running.

Wolfgang

Post Reply

Return to “mikroC General”