mod04 ex01 trigger timer0 set but not working

This commit is contained in:
hugo LAMY
2025-03-11 22:40:13 +01:00
parent d0427ce83d
commit b487d8f353
2 changed files with 58 additions and 25 deletions

View File

@@ -1,8 +1,18 @@
#ifndef TIMER_H
#define TIMER_H
// table 16-5 : prescale sets
#define PRESCALE_SET(value) \
// table 15-9 : timer 0 prescale sets
#define T0_PRESCALE_SET(value) \
((value) == 1 ? (0<<CS02 | 0<<CS01 | 1<<CS00) : \
(value) == 8 ? (0<<CS02 | 1<<CS01 | 0<<CS00) : \
(value) == 64 ? (0<<CS02 | 1<<CS01 | 1<<CS00) : \
(value) == 256 ? (1<<CS02 | 0<<CS01 | 0<<CS00) : \
(value) == 1024? (1<<CS02 | 0<<CS01 | 1<<CS00) : \
(0<<CS02 | 0<<CS01 | 0<<CS00))
#define TIME_MS(ms, prescale_value) (((F_CPU / prescale_value) * ms) / 1000)
// table 16-5 : timer 1 prescale sets
#define T1_PRESCALE_SET(value) \
((value) == 1 ? (0<<CS12 | 0<<CS11 | 1<<CS10) : \
(value) == 8 ? (0<<CS12 | 1<<CS11 | 0<<CS10) : \
(value) == 64 ? (0<<CS12 | 1<<CS11 | 1<<CS10) : \