Einfach auskommentieren.
Oder mit Makros vom Compilieren ausschliessen:
1 | // #define USE_SLEEP
|
2 |
|
3 | #include <avr/io.h>
|
4 | #include <inttypes.h>
|
5 | #include <stdlib.h>
|
6 | #include <avr/interrupt.h>
|
7 | #include <avr/sleep.h>
|
8 |
|
9 | SIGNAL (SIG_INTERRUPT0)
|
10 | {
|
11 | MOTOR_Stop ();
|
12 | }
|
13 |
|
14 |
|
15 | int main (void)
|
16 | {
|
17 |
|
18 | // Initialize Modules
|
19 | MOTOR_Init();
|
20 | CAN_Init();
|
21 | #ifdef USE_SLEEP
|
22 | sleep_enable();
|
23 | set_sleep_mode (SLEEP_MODE_IDLE);
|
24 | #endif
|
25 | sei();
|
26 | DDRD |= (1 << PD0);
|
27 | PORTD |= (1 << PD0); //Das ist der INT0-Eingang
|
28 | EIMSK |= (1 << INT0);
|
29 | EICRA |= (1 << ISC01);
|
30 |
|
31 | // Everything is ready, Start Main Loop
|
32 | while (1)
|
33 | {
|
34 | #ifdef USE_SLEEP
|
35 | sleep_mode();
|
36 | #endif
|
37 | }
|
38 | return 0;
|
39 | }
|
Wenn du dann vom Simulator auf die reale Hardware gehst,
dann nimmst du den Kommentar an der ersten Zeile wieder
raus, compilierst neu und die Sleep Funktionalität ist
wieder im Programm enthalten.