I would like to publish my first AVR8 project soon.
The aim is to software-extend the range of the hardware timer of an AVR8 to an arbitrary value.
Including OCRs, PWM modes, ICPs, IRQs etc.
Actually, the code was ready long time ago but I only extended one mode and one PWM channel so I would like to ask The Freaks if anyone knows of any complete extension of this type because if there is one ready-made then there is no point updating mine.
I did some initial searching in here but implementations I could find are buggy and either introduce jitter or require ridiculous IRQ delays/CPU time. Or both.
- is written in C,
- is IRQ-based,
- does not access DDR/PIN/PORT registers,
- has "0-tick error",
- the permissible IRQ servicing delay time is constant and equal to TOV,
- occupies <10% of CPU when extending 8-bit timer, prescaler set to 8,
- occupies <0.5% of CPU when extending 16-bit timer, prescaler set to 1.
By "0-tick error" I mean that if I take an AVR with 8-bit and 16-bit hardware timers (m16) and run this extension on an 8-bit timer to software-extend it to 16-bit, with OC pin in some PWM mode, and compare generated PWM against regular 16-bit hardware timer with same mode, OCR values, prescalers, TOP etc, then both PWMs coincide (are exactly the same), even when OCR values are modified along the way, other IRQs are triggering, etc.
Any similar "0-tick error" extensions known?