Hallo, Ich versuche gerade zu verstehen wie man mit einem pointer (Zeiger) arbeitet, aber irgendwie funktioniert meine for schleife nicht. Hat jemand einen Tipp für mich?
1 | #include <avr/io.h> |
2 | #include <stdio.h> |
3 | |
4 | #include "warte.h" |
5 | |
6 | int main (void) |
7 | {
|
8 | //porteinstellungen
|
9 | DDRB = 0x02; //PB1 als Ausgang |
10 | PORTB = 0x00; //pullups ausschalten |
11 | DDRC = 0x23; //PC0,1,5 als Ausgang |
12 | PORTC = 0x00; //pullups ausschalten |
13 | DDRD = 0xF8; //PD3,4,5,6,7 als Ausgang |
14 | PORTD = 0x00; //pullups ausschalten |
15 | |
16 | volatile unsigned int istpos; |
17 | volatile unsigned int *p_istpos; |
18 | |
19 | p_istpos = &istpos; |
20 | |
21 | |
22 | // for (istpos = 0; istpos <= 5; istpos++) funktioniert
|
23 | for (*p_istpos = 0; *p_istpos <= 5; *p_istpos++) //funktioniert nicht |
24 | {
|
25 | PORTC |= (1<<PC0); |
26 | warte_ms(200); |
27 | PORTC &= ~(1<<PC0); |
28 | warte_ms(200); |
29 | }
|
30 | }
|