I don't know about the +/- 1 (and 65535 or 5=65536) by heart, but I am sure the datasheet has info on this.
The timer0-example uses the 8-bit timer on 16f chips. If you have a 16bit timer, take prescaler 1, since 12000 is way below the 16-bit limit. Joep 2010/4/30 funlw65 <[email protected]>: > Hi guys, > > Can anyone help me to get the right numbers? > > Is about an USB board with 18F2550/4550 at 48MHz (the name and the > color of the board does not matter). > > I want 1KHz rate. > > So, until now we have > 48_000_000 / 4 / 1000 = 12_000 - 1 = 11_999 > > According to timer0_isr_interval library, this number is lower than > ((64 * 256) - 1)) > but bigger than > ((32 * 256) - 1)) > so, we have T0CON_T0PS = 5 which mean prescaler = 64 > > Until now, we obtained the complete number for T0CON > which is 0x85, which exploded mean: > > T0CON > 1 - TMR0ON > 0 - T08BIT > 0 - T0CS > 0 - T0CE > 0 - PSA > 1 - T0PS2 > 0 - T0PS1 > 1 - T0PS0 > > Ok, we take our number of 11_999 and divide with prescaler 64 > 11_999 / 64 = 187 then, > 65535 - 187 = 65348 = 0xFF44 > > Now I have the value for TMR0H and TMR0L > TMR0H = 0xFF > TMR0L = 0x44 > > This is right? If I choose an interval of 1000 i will get one second > delay? > > Thank you! > > Vasi(funlw65) > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/jallib?hl=en. > > -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
