update ex02 comments

This commit is contained in:
hugo LAMY
2025-03-06 12:33:32 +01:00
parent 9398b623af
commit 25541d0582

View File

@@ -76,13 +76,13 @@ int main() {
SET(TCCR1B, WGM12);
SET(TCCR1B, WGM13);
// Table 16-2 : Non-inverting mode, the LED will be ON for DUTY_CYCLE% of the time (CLEAR OC1A on compare match, SET OC1A at BOTTOM)
// Table 16-2 : non-inverting mode, the LED will be ON for DUTY_CYCLE% of the time (CLEAR OC1A on compare match, SET OC1A at BOTTOM)
SET(TCCR1A, COM1A1);
// set the period (compare TOP value)
// Table 16-4 : set the period (compare TOP value)
ICR1 = TIME_MS(PERIOD);
// set the duty cycle to DUTY_CYCLE% of the time
// 16.9.3 : set the duty cycle to DUTY_CYCLE% of the time -> OC1A (alternate function of PORTB1, aka LED2) is cleared when TCNT1 (the counter value) equals OCR1A
OCR1A = TIME_MS(DUTY_CYCLE);
// start the timer with the prescaler