piclist 2001\01\11\090523a >
Thread: help...TMR0 interupt
face picon face BY : Olin Lathrop email (remove spam text)

> anyone have some code that shows ALL the pieces to generate a TMR0
interupt > on
> rollover?

Here are the relevant sections of code that runs on a 16C66:

;   Set up the timer 0 configuration.  This will be used to generate
;   pixel clock interrupts.
        dbankif option_reg
        movlw   b'10001000'
                ; 1-------  port B pullups disabled (port B used for output)
                ; -X------  RB0 interrupt edge select
                ; --0-----  timer 0 source is instruction clock
                ; ---X----  timer 0 external clock edge select
                ; ----1---  prescaler assigned to watchdog timer
                ; -----XXX  prescaler value
        movwf   option_reg
;   Enable interrupts.  Interrupts will be globally enabled, but the timer
;   0 interrupt is not enabled.  This will be done by the ROTATION routine
;   at the next rotation tick.
        dbankif tmr0
        clrf    tmr0        ;leave maximum time until next timer 0 interrupt

        dbankif intcon
        clrf    intcon      ;clear any pending interrupt flags
        bsf     intcon, gie ;globally enable interrupts

;   Enable the timer 0 interrupt.
        bsf     intcon, t0ie ;make sure timer 0 interrupts are enabled

Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, @spam@olin@spam@spamembedinc.com, http://www.embedinc.com

http://www.piclist.com hint: To leave the PICList

<002701c07bd2$70c0b540$260bf6cd@pc> 7bit

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) help...TMR0 interupt

month overview.

new search...