added comments on mod01 ex00
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
#define TURN_OFF_LED(bit) CLEAR(PORTB, bit)
|
#define TURN_OFF_LED(bit) CLEAR(PORTB, bit)
|
||||||
#define TOGGLE_LED(led) TOGGLE_PIN(B, led)
|
#define TOGGLE_LED(led) TOGGLE_PIN(B, led)
|
||||||
|
|
||||||
|
// ELEMENTS
|
||||||
#define D1 0
|
#define D1 0
|
||||||
#define D2 1
|
#define D2 1
|
||||||
#define D3 2
|
#define D3 2
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
#define SW1 2
|
#define SW1 2
|
||||||
#define SW2 4
|
#define SW2 4
|
||||||
|
|
||||||
|
// TIME
|
||||||
#define PRESCALE_VALUE 1024
|
#define PRESCALE_VALUE 1024
|
||||||
#if (PRESCALE_VALUE == 1)
|
#if (PRESCALE_VALUE == 1)
|
||||||
#define PRESCALE_SET (1 << CS10)
|
#define PRESCALE_SET (1 << CS10)
|
||||||
@@ -52,6 +53,8 @@ int main() {
|
|||||||
TURN_OFF_LED(D2);
|
TURN_OFF_LED(D2);
|
||||||
|
|
||||||
TCCR1B |= (PRESCALE_SET); // set timer with prescale
|
TCCR1B |= (PRESCALE_SET); // set timer with prescale
|
||||||
|
// -> set timer with bits CS10-12, in register TCCR1B : 16.4 Timer/Counter Clock Sources
|
||||||
|
// -> prescale values : 16.11.2 TCCR1B – Timer/Counter1 Control Register B, table 16-5. Clock Select Bit Description
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
if ( TCNT1 >= TIME_MS(500)) {
|
if ( TCNT1 >= TIME_MS(500)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user