Sound timer PWM fast mode
Posted: Wed Feb 28, 2018 3:19 am
I have a question that has been nagging me for some time. I read the uzebox code and get most of the important bits. I just don't get the low level sound stuff. I have some experience with AVRs but have been away for months. So maybe you can correct my assumptions.
The timer 1 is set with no prescaler and takes 1820 cycles for complete ntsc line, visible + non-visible.
The timer 2 is fast pwm with no prescaler and goes to max (0xff) and rollsover . In that mode when timer hits compare reg the pin clears and sets again at timer=0. And the compare reg is set to the next value in the sound buffer every ntsc line. So I don't get the fact that the sound timer doesn't seem to be a ratio to the 1820 number. I thought I had searched most of the timer regs for setting or adjusting that changes the math but I certainly could have missed it.
Thanks,
Eric
The timer 1 is set with no prescaler and takes 1820 cycles for complete ntsc line, visible + non-visible.
The timer 2 is fast pwm with no prescaler and goes to max (0xff) and rollsover . In that mode when timer hits compare reg the pin clears and sets again at timer=0. And the compare reg is set to the next value in the sound buffer every ntsc line. So I don't get the fact that the sound timer doesn't seem to be a ratio to the 1820 number. I thought I had searched most of the timer regs for setting or adjusting that changes the math but I certainly could have missed it.
Thanks,
Eric