View previous topic :: View next topic |
Author |
Message |
sraiderk
Joined: 09 Feb 2005 Posts: 48
|
Timer1 question |
Posted: Fri Feb 25, 2005 9:39 am |
|
|
İf I use 16f877 with setting of the timer1 the following
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); //20MHz cristal
104,857ms time later interrupt occurs. My question is that if I define setup_timer with the same configuration like that
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8 |T1_DIV_BY_8);
interrupt occurs at that time later 104,857*8=838,860ms doesn't it? |
|
![](templates/subSilver/images/spacer.gif) |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Feb 25, 2005 10:09 am |
|
|
Copied from the Compiler HELP:
_____________________________________________________________
SETUP_TIMER_1( )
Syntax:
setup_timer_1 (mode)
Parameters:
mode values may be:
- T1_DISABLED, T1_INTERNAL, T1_EXTERNAL, T1_EXTERNAL_SYNC
- T1_CLK_OUT
- T1_DIV_BY_1, T1_DIV_BY_2, T1_DIV_BY_4, T1_DIV_BY_8
constants from different groups may be or'ed together with |.
_____________________________________________________________
Hence, in your expresion:
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8 |T1_DIV_BY_8);
T1_DIV_BY_8 | T1_DIV_BY_8 Is Not Valid because you are ORed
two constants of the same group.
Humberto |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Feb 25, 2005 10:43 am |
|
|
It will actually be the same since oring something with itself is the same. Read the datasheet on the PIC and you will see the available scalers or divide bys. |
|
![](templates/subSilver/images/spacer.gif) |
|