diff --git a/module01/ex01/main.c b/module01/ex01/main.c index 969e762..821f707 100644 --- a/module01/ex01/main.c +++ b/module01/ex01/main.c @@ -71,7 +71,7 @@ int main() { TCCR1A |= (1 << COM1A0); // 14.3.1 : set Compare Output with COM1A0, it toggles OC1A on compare match (Table 16-1), OC1A is alternate function for PORTB1 (Table 14-3) - OCR1A = TIME_MS(PERIOD); // Table 16-4 : set CTC compare value, the counter is cleared to zero when the counter value (TCNT1) matches the OCR1A register + OCR1A = TIME_MS(PERIOD); // Table 16-4 : set CTC compare value on channel A, the counter is cleared to zero when the counter value (TCNT1) matches the OCR1A register TCCR1B |= (PRESCALE_SET(PRESCALE_VALUE)); diff --git a/module01/ex02/main.c b/module01/ex02/main.c index 50cf69d..e6c58c7 100644 --- a/module01/ex02/main.c +++ b/module01/ex02/main.c @@ -77,7 +77,7 @@ int main() { ICR1 = TIME_MS(PERIOD); // Table 16-4 : set the period (compare TOP value) - OCR1A = TIME_MS(PERCENT(DUTY_CYCLE, PERIOD)); // 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(PERCENT(DUTY_CYCLE, PERIOD)); // 16.9.3 : set the duty cycle to DUTY_CYCLE% of the time on channel A -> OC1A (alternate function of PORTB1, aka LED2) is cleared when TCNT1 (the counter value) equals OCR1A TCCR1B |= (PRESCALE_SET(PRESCALE_VALUE)); // start the timer with the prescaler diff --git a/module01/ex03/main.c b/module01/ex03/main.c index 042de93..079bba8 100644 --- a/module01/ex03/main.c +++ b/module01/ex03/main.c @@ -123,7 +123,7 @@ int main() { ICR1 = TIME_MS(PERIOD); // Table 16-4 : set the period (compare TOP value) - OCR1A = TIME_MS(PERCENT(DUTY_CYCLE, PERIOD)); // 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(PERCENT(DUTY_CYCLE, PERIOD)); // 16.9.3 : set the duty cycle to DUTY_CYCLE% of the time in channel A -> OC1A (alternate function of PORTB1, aka LED2) is cleared when TCNT1 (the counter value) equals OCR1A TCCR1B |= (PRESCALE_SET(PRESCALE_VALUE)); // start the timer with the prescaler diff --git a/module02/ex01/main.c b/module02/ex01/main.c index 7c9cbae..9ec71cb 100644 --- a/module02/ex01/main.c +++ b/module02/ex01/main.c @@ -132,6 +132,7 @@ void uart_printstr(const char* str) { } // print hello world, on serial port, every 2 seconds, with empty infinite loop +// `screen /dev/ttyUSB0 115200` int main() { uart_init(); @@ -141,7 +142,7 @@ int main() { TIMSK1 |= (1 << OCIE1A); // Enable CTC interrupt sei(); // Enable global interrupts - OCR1A = TIME_MS(PERIOD); // Table 16-4 : set CTC compare value, the counter is cleared to zero when the counter value (TCNT1) matches the OCR1A register + OCR1A = TIME_MS(PERIOD); // Table 16-4 : set CTC compare value on channel A, the counter is cleared to zero when the counter value (TCNT1) matches the OCR1A register TCCR1B |= (PRESCALE_SET(PRESCALE_VALUE)); // 16.4 : set timer according to prescale value, in register TCCR1B, table 16-5 : prescale sets