Open GoogleCodeExporter opened 8 years ago
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:06