wokwi / avr8js

Arduino (8-bit AVR) simulator, written in JavaScript and runs in the browser / Node.js
https://blog.wokwi.com/avr8js-simulate-arduino-in-javascript/
MIT License
462 stars 73 forks source link

Timer Output Compare does not work correctly in PWM modes #78

Closed urish closed 3 years ago

urish commented 3 years ago

According to the datasheet, the waveform generator uses the COMnx0/1 bits differently in normal, CTC, and PWM modes. Specifically, in FastPWM mode:

image

image

image

and in Phase-correct PWM modes:

image

image

image

We need to implement this behavior in the simulator.