1 | #include <stdint.h>
|
2 | #include <avr/delay.h>
|
3 |
|
4 |
|
5 |
|
6 | /* ------------------------------------------------------------------------------------------ */
|
7 | /* Controller Initialisierung */
|
8 | /* ------------------------------------------------------------------------------------------ */
|
9 | void ioinit()
|
10 | {
|
11 | /* -------------------------------------------------------------------------------------- */
|
12 | /* Config Ports */
|
13 | /* -------------------------------------------------------------------------------------- */
|
14 |
|
15 | // Port B duch Ausgabe von 0xFF ins Richtungsregister DDRB als Ausgang konfigurieren
|
16 | DDRB = (1<<PB0) | (1<<PB1) | (1<<PB2) | (1<<PB3) | (1<<PB4) | (1<<PB5) | (1<<PB6) | (1<<PB7);
|
17 |
|
18 | // Setze alle Signale auf 0
|
19 | PORTB = 0b00000000;
|
20 | }
|
21 |
|
22 |
|
23 | /* ====================================================================================== */
|
24 | /* Hauptprogramm */
|
25 | /* -------------------------------------------------------------------------------------- */
|
26 |
|
27 | int main(void)
|
28 | {
|
29 |
|
30 | /* Peripherie initialisieren */
|
31 | ioinit();
|
32 |
|
33 |
|
34 | while(1){
|
35 |
|
36 |
|
37 | _delay_loop_2 (3800); // ca. 2ms Pause
|
38 | PORTB |= (1 << PB0); // PB0 setzen
|
39 | _delay_loop_2 (1900); // ca. 1ms
|
40 | PORTB &= ~(1 << PB0); // PB0 löschen
|
41 |
|
42 |
|
43 | }
|
44 |
|
45 | }
|