Searching \ for 'Setting up TMR1, what am I missing?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=setting+tmr1+what
Search entire site for: 'Setting up TMR1, what am I missing?'.

Truncated match.
PICList Thread
'Setting up TMR1, what am I missing?'
1996\05\15@222506 by Xaq

flavicon
face
Once again, I must be missing something.

I am trying to set up the TMR1, on the '74, as a timer with a prescaler of 4
that will trigger an interrupt on overflow.

This is what I have setup so far:

       Intcon  - GIE =1                ;global int's enabled
                 the rest=0

       PIE1    - TMR1IE =1             ;enable TMR1IF interrupt
                 the rest=0

       T1CON   - TMR1ON=1              ;starts timer
                 T1CKPS0=0             ;sets prescaler
                 T1CKPS0=1             ;  "  "
                 the rest=0

I have had no problems using TMR0, but TMR1 just wont work.  My int-service
routine just buzzes a buzzer to let me know that the overflow has happened.
But, I get no buzz.  I am not even trying to desern which interrupt has
happened, just buzz the buzzer.


Thanks for your help

Zach


PS  I know the buzzer is working   : )

1996\05\15@224635 by fastfwd

face
flavicon
face
Xaq <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> I am trying to set up the TMR1, on the '74, as a timer with a
> prescaler of 4 that will trigger an interrupt on overflow.
> ....
>         Intcon  - GIE =1                ;global int's enabled
>                   the rest=0
>
>         PIE1    - TMR1IE =1             ;enable TMR1IF interrupt
>                   the rest=0
>
>         T1CON   - TMR1ON=1              ;starts timer
>                   T1CKPS0=0             ;sets prescaler
>                   T1CKPS0=1             ;  "  "
>                   the rest=0
>
> .... TMR1 just wont work.

   Zack:

   Set the PEIE bit in the INTCON register.

   -Andy

Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
Fast Forward Engineering, Vista, California
http://www.geocities.com/SiliconValley/2499

1996\05\15@232159 by Xaq

flavicon
face
>>.... TMR1 just wont work.
>
>    Zack:
>
>    Set the PEIE bit in the INTCON register.

Thanks Andy, but I had already tried that and it still didn't work.  Are the
timers peripherals?  Any other suggestions?

Thanks

Zach

1996\05\16@050527 by Jim Main

flavicon
face
>I am trying to set up the TMR1, on the '74, as a timer with a prescaler of 4
>that will trigger an interrupt on overflow.
>
>This is what I have setup so far:
>
>        Intcon  - GIE =1                ;global int's enabled
>                  the rest=0
>
>        PIE1    - TMR1IE =1             ;enable TMR1IF interrupt
>                  the rest=0
>
>        T1CON   - TMR1ON=1              ;starts timer
>                  T1CKPS0=0             ;sets prescaler
>                  T1CKPS0=1             ;  "  "
>                  the rest=0

PEIE needs to be set - as already stated by Andrew Warren

TMR1CS needs to be 0 (internal clock)
T1OSCEN could be turned off for good measure as well

Are you remembering to initialise the TMR1H and TMR1L registers - as well as
re-loading them when entering the interrupt service routine?

Also, did you clear PIR1  - TMR1IF before you enabled the interrupt for the
first time (and does your interrupt service routine clear it again?)

I did all that, and mine is quite happily giving me a 2mS interrupt...

Jim

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...