Die Laufbedingung bricht ab und das Programm startet von beginn (Wie RESET). Wenn Variablen fahrt_counter = 0; counter_endwert = 0 in PrintData() gelöscht werden, wiederholt die while (fahrt_counter > 3) problemlos. wenn ich Variable fahrt_counter = 0; counter_endwert = 0 dazu schreibe, bricht die Laufbedingung der while (fahrt_counter > 3) aber auch while(1) !!!! warum ? kann jemand mir das erklären warum mein Code so läuft. Danke
1 | int main () { |
2 | Konf_GPIO(); |
3 | Konf_Timer(); |
4 | Konf_SPI_MASTER(); |
5 | Konf_ADC(); |
6 | sei(); |
7 | Dummy_Readout_ADC(); |
8 | Konf_Motor(); |
9 | |
10 | while (1) { |
11 | |
12 | if (counter_Umax > counter_Umax_alt && counter_Umax < 10) { |
13 | E_Umax += 10; |
14 | counter_Umax_alt = counter_Umax; |
15 | }
|
16 | |
17 | ...
|
18 | ...Funktionen(); |
19 | |
20 | PrintData(); |
21 | while ((micros() - timer_ms[0]) < 1000 * dt); |
22 | }
|
23 | |
24 | }
|
25 | |
26 | |
27 | |
28 | void PrintData() { |
29 | |
30 | if (sollwert == endwert) { |
31 | if (counter_endwert % slope == 0) { |
32 | fahrt_counter++; |
33 | zeitrampe = 0; |
34 | while (fahrt_counter > 3) { |
35 | if (fahrt_counter < 5) { |
36 | print_Data_speicher(); |
37 | }
|
38 | counter++; |
39 | _delay_ms(20); |
40 | ADC_einzelmessungen(); |
41 | standby(1); |
42 | if (counter % 100 == 0) { |
43 | printFile(); |
44 | fahrt_counter = 0; |
45 | counter_endwert = 0; |
46 | counter_Umax++; |
47 | _delay_ms(1000); |
48 | }
|
49 | fahrt_counter++; |
50 | }
|
51 | }
|
52 | counter_endwert++; |
53 | }
|
54 | }
|