update mod01 ex01 main comment

This commit is contained in:
hugo LAMY
2025-03-07 08:03:17 +01:00
parent 928f897992
commit c037b5184d

View File

@@ -62,9 +62,11 @@
#define PRESCALE_SET (1 << CS10) | (1 << CS12)
#endif
#define TIME_MS(ms) (((F_CPU / PRESCALE_VALUE) * ms) / 1000)
#define PERIOD 500
// END MACROS
// led turns on and off every PERIOD ms
int main() {
MODE_OUTPUT(LED2);
@@ -72,13 +74,11 @@ 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(500); // 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, the counter is cleared to zero when the counter value (TCNT1) matches the OCR1A register
TCCR1B |= (PRESCALE_SET);
while(1) {
continue;
}
while(1);
}