----- Original Message ----- From: "Nick Veys" To: Sent: Friday, April 27, 2001 11:45 AM Subject: Re: [PIC]: tmr0 on 16F84 interrupt period > Ok, so I have the clock coming in @ 4MHz, effectively 1MHz to the processor. > If I set the prescalar to 1 and assign it to the WDT I'll get a 1:1 > prescalar and an interrupt every ~244us. Now I know that I can add to that > value to speed it up so that's good, but my one problem with this is, I > don't want to use the Watchdog timer... If I have it disabled but still > assign the prescalar to the watchdog, will it be disabled? The /only/ > interrupt I want is the tmr0 one. By default after power on, the prescaler is assigned to WDT (OPTION_REG is initialized to all ones after POR). Changing assignment(OPTION_REG, PSA) or value(OPTION_REG PS0,PS1,PS2) of prescaler does not affect whether WDT is enabled. If the config bit is set during programming so that WDT is disabled(WDTE cleared), then it is disabled.<-(period) By the way, in terms of TMR0 the prescaler cannot be set to one. Once it is assigned to TMR0, the prescaler is automatically at least two (with all bits cleared). The way it is set to one is by assigning it to the WDT. In which case you should receive an interrupt roughly every 256 us from TMR0. Provided that you re-enable them everytime, that is. :-) If you write to TMR0 then it will not start incrementing for two machine cycles. > > > >Just double checking this. At 4MHz, the timer will interrupt every: > > >256((2^(prescaler+1)/(2^22)) seconds. So with a 0 prescalar you'll be > > >getting an interrupt every: 256(2/(2^22)) seconds (122us)? This > > appears to > > >be the smallest obtainable period with this clock speed. If anyone can > > >confirm this, it'd be much appreciated!! > > > > No, actually at 4MHz, TMR0 will interrupt every 256us with a 1:1 > > prescaler. > > > > >sheet, I'd appreciate that too. The datasheet merely says 1:2 .. 1:256 > > >prescalars are available and I only assume that means > > clock/2^(prescale+1). > > > > The datasheet says that the minimum prescale value for TMR0 is 1:2 when > > assigned to TMR0. To achieve a 1:1 scale for TMR0, assign the > > prescaler to > > the WDT instead of TMR0. > > > > --Andrew > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads