You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The rtc_isr_tmr0 library contains some hard coded constants (hi,mid,lo) for
a specific oscillator frequency (20MHz).
This means that the user would have to change the library when using a
different oscillator frequency.
Request: the library should adapt itself automatically to the oscillator
speed.
Original issue reported on code.google.com by robhamerling on 24 Oct 2009 at 8:06
The text was updated successfully, but these errors were encountered:
A quick fix could be to replace the hard coded values of hi,mid and lo by:
const byte hi = (target_clock / 4) / 65536
const byte mid = (target_clock / 4) % 65536 / 256
const byte lo = (target_clock / 4) % 256
This makes the library independent of the oscillator frequency.
However the working of the Interrupt service routine depends also on the proper
setting of OPTION_REG, in particular the PS and PSA bits. This is currently not
handled by this library and not mentioned in the comments/docs too.
Original comment by robhamerling on 24 Oct 2009 at 12:33
This code-change has proven to be working correctly, but some more improvents
may be
desired, like:
1. Support for oscillator frequencies higher than 64 MHz, either by using a
larger
counter (4 bytes in stead of 3) or by using a prescaler value for the timer (to
bu
user specified.
2. Convert the code to native JAL. The site of Roman Black shows some examples
in
C-language which can be converted to Jal easily. A first attempt shows a slight
increase of code space. The amount depends on the size of the counter field.
Original comment by robhamerling on 25 Oct 2009 at 10:44
Original issue reported on code.google.com by
robhamerling
on 24 Oct 2009 at 8:06The text was updated successfully, but these errors were encountered: