You're welcome. And.... >> 48_000_000 / 4 (default) / 64 (prescaler) / 188 = 997,3 kHz
Must of course be 997,3 Hz, not kHz. Joep 2010/4/30 funlw65 <[email protected]>: > Thank you very much! > > Vasi(funlw65) > > On Apr 30, 4:34 pm, Joep Suijs <[email protected]> wrote: >> On an 18f4550, timer0 is default in 8-bit mode, so I expect the code >> works as is. But I hardly ever use 18f chips. Matt can probably tell >> you more about timers on 18F chips. >> >> And if you have 48MHz clock, prescaler 64 and load the timer with >> 0x44, Then the frequency will be: >> >> Counts = 0x100 - 0x44 = 0xBC = 188 decimal >> >> 48_000_000 / 4 (default) / 64 (prescaler) / 188 = 997,3 kHz >> >> The actual frequency will be a bit lower, since it takes a few >> microseconds time from the actual interupt to the point that 0x44 is >> actually loaded into the timer-register. >> If you want to be more accurate (and stable), take a timer with a >> reload-function (e.q. the ones used for pwim - timer2 on 16f877 and >> 18f4550). >> >> Joep >> >> 2010/4/30 funlw65 <[email protected]>: >> >> >> >> > Hi Joep, >> >> > How you would translate in numbers the library of >> > timer0_poll_interval.jal which I think is working with 18F chips? I >> > didn't choose anything except the 1000KHz rate. I just tried to >> > translate in numbers every step to see how is working and to try to >> > have a modified timer0_isr_interval.jal. >> > If you follow the line of timer0_poll_interval.jal and translate >> > anything in numbers, you obtain what I wrote in first post. >> > I really did nothing else, even the prescaler is calculated from the >> > target_clock. In datasheet is not much.... >> >> > Vasi(funlw65) >> >> > On Apr 30, 2:33 pm, Joep Suijs <[email protected]> wrote: >> >> 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 >> >> > athttp://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 >> >> athttp://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 >> > athttp://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 >> athttp://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. > > -- 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.
