View previous topic :: View next topic |
Author |
Message |
Louati
Joined: 26 Mar 2012 Posts: 16
|
using timer pic18f4550 |
Posted: Mon Jun 25, 2012 12:28 pm |
|
|
Hello
The timer0, timer1, timer2 and timer3 in pic 18f4550 are defined by 16bit(8bit timer0L and 8 bit timer0H) and the same for others timers.
The question is when I use ccs the interrupt caused by a timer will be when the timer0L is overflowed or when the timer0H is overflowed ? |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Mon Jun 25, 2012 1:27 pm |
|
|
I find it's easiest to sometimes read the microchip data sheet.
For instance, timer0 can operate in both 8 and 16 bit modes.
Quote: |
11.4 Timer0 Interrupt
The TMR0 interrupt is generated when the TMR0
register overflows from FFh to 00h in 8-bit mode, or
from FFFFh to 0000h in 16-bit mode. This overflow sets
the TMR0IF flag bit.
|
Mike |
|
|
Louati
Joined: 26 Mar 2012 Posts: 16
|
|
Posted: Mon Jun 25, 2012 1:57 pm |
|
|
Mike Walne wrote: | I find it's easiest to sometimes read the microchip data sheet.
For instance, timer0 can operate in both 8 and 16 bit modes.
Quote: |
11.4 Timer0 Interrupt
The TMR0 interrupt is generated when the TMR0
register overflows from FFh to 00h in 8-bit mode, or
from FFFFh to 0000h in 16-bit mode. This overflow sets
the TMR0IF flag bit.
|
Mike |
yes it's so clear from the datasheet but the problem that I use the CCS compiler and I don't know if it work with 8 bit configuration or 16 bit and how to update it ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19482
|
|
Posted: Mon Jun 25, 2012 2:32 pm |
|
|
Look at the processor include file. Little entries like:
T0_8_BIT
......
Default is always 16bit operation.
Best Wishes |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Tue Jun 26, 2012 2:03 am |
|
|
Quote: | The question is when I use ccs the interrupt caused by a timer will be when the timer0L is overflowed or when the timer0H is overflowed ? | Sorry, had not understood original question. What you meant was that you wanted to know which mode you were in with CCS.
Quote: | Look at the processor include file. Little entries like:
T0_8_BIT
......
Default is always 16bit operation. |
That's confusing for me when microchip defaults the other way.
Quote: | 9.8 TMR0 Interrupt
In 8-bit mode (which is the default), an overflow in the
TMR0 register (FFh → 00h) will set flag bit, TMR0IF. In
16-bit mode, an overflow in the TMR0H:TMR0L register |
Mike |
|
|
|