
Въпрос за Timer0 fast PWM Atmega328
Здравейте,
Ето какво пише в дейташита:
 |  |  |
 | Цитат: The fast Pulse Width Modulation or fast PWM mode (WGM02:0 = 3 or 7) provides a high frequency PWM waveform generation option. The fast PWM differs from the other PWM option by its single-slope operation. The counter counts from BOTTOM to TOP then restarts from BOTTOM. TOP is defined as 0xFF when WGM2:0 = 3, and OCR0A when WGM2:0 = 7. In non-inverting Compare Output mode, the Output Compare (OC0x) is cleared on the compare match between TCNT0 and OCR0x, and set at BOTTOM. In inverting Compare Output mode, the output is set on compare match and cleared at BOTTOM. Due to the single-slope operation, the operating frequency of the fast PWM mode can be twice as high as the phase correct PWM mode that use dual-slope operation. This high frequency makes the fast PWM mode well suited for power regulation, rectification, and DAC applications. High frequency allows physically small sized external components (coils, capacitors), and therefore reduces total system cost. In fast PWM mode, the counter is incremented until the counter value matches the TOP value. The counter is then cleared at the following timer clock cycle. The timing diagram for the fast PWM mode is shown in Figure 15-6. The TCNT0 value is in the timing diagram shown as a histogram for illustrating the single-slope operation. The diagram includes non-inverted and inverted PWM outputs. The small horizontal line marks on the TCNT0 slopes represent compare matches between OCR0x and TCNT0. |  |
 |  |  |
Това, което ми е ясно е следното:
Ако WGM2:0 = 3 тогава TOP 0xFF.
TCNT0 нараства от BOTTOM (0) до 0хFF и пак става 0.
Когато TCNT0 стане равен на OCR0A състоянието изхода става да речем 1 (зависи от инв. моде)
Това, което не ми е ясно:
Ако WGM2:0 = 7, TOP се задава от OCR0A.
TCNT0 нараства от 0 до OCR0A.
С кой регистър се сравнява TCNT0 за да се смени състоянието на изхода ?
Въпроса може да е елементарен или тъп, но навсякъде в нета е copy/pase-вано и не мога да намеря просто информация за всеки режим с какво се сравнява и колко е ТОП-а.