Hallo ich bins nochmal.
Entweder steh ich suchtechnisch total auf der Leitung oder es hatte noch
niemand das Prob vorher:
Ich will also besagten Watchdog nur zum Interrupt auslösen nehmen, im
Moment wird jedoch der ganze Chip resettet (Watchdog FUse ist nicht
programmiert):
Hier mal ein kleiner Codeauszug:
1 | #define F_CPU 8000000 //CPU Frequenz
|
2 | #include <avr/io.h>
|
3 | #include <avr/interrupt.h>
|
4 | #include <avr/wdt.h>
|
5 | #include <avr/sleep.h>
|
6 | #include <stdlib.h>
|
7 | #include <util/delay.h>
|
8 |
|
9 |
|
10 | void CPU_INI(void)// Initialisieren des µCs
|
11 | {
|
12 | cli(); //Interrupts deaktivieren
|
13 |
|
14 | //Port init
|
15 | PORTB = 0X00; //PORTB BITS
|
16 | DDRB = 0x4F; //Port B PB0 und PB2 Ausgaenge, Rest Eingaenge
|
17 | PORTA = 0X00; //PORTA BITS
|
18 | DDRA = 0x76; //PORTA alles Eingaenge
|
19 | MCUCR = 0x00;
|
20 | OSCCAL = 0x80;
|
21 | GIMSK = 0x00;
|
22 | TIMSK = 0x00;
|
23 | EECR = 0x00;
|
24 | //SEI(); //Interrups wieder aktivieren
|
25 | }
|
26 |
|
27 | // **** Main Schleife ****
|
28 |
|
29 | int main(void)
|
30 | CPU_INI();
|
31 | while(1)
|
32 | { //KOntrollschleife
|
33 | if(flag_volt_lamp) //Eingangsspannung fehlerhaft im vorhergehenden Takt
|
34 | {
|
35 | while(flag_volt_lamp)
|
36 | {
|
37 | set_sleep_mode(SLEEP_MODE_PWR_DOWN);
|
38 | wdt_enable(6);
|
39 | sei();
|
40 | sleep_cpu();
|
41 | wdt_disable();
|
42 | cli();
|
43 | U_V = le_ad(CANAL_OP_VOLTAGE,1);
|
44 | if((800 > U_V) || (U_V > 380)) break;
|
45 | }
|
46 | _delay_ms(400); //Pause einlegen
|
47 | _delay_ms(400);
|
48 | }
|
49 |
|
50 |
|
51 | while(1) //Hauptschleife fuer Dauerbetrieb
|
52 | {
|
53 | //normaler Programmablauf/Regelalgorithmus
|
54 | U_V = le_ad(CANAL_OP_VOLTAGE,1);
|
55 |
|
56 | if(((750 < U_V) || (U_V < 430)))
|
57 | {
|
58 | flag_volt_lamp = 1;
|
59 | break;
|
60 | }
|
61 | }
|
62 | }
|
63 | }
|
64 |
|
65 | ISR(WDT_vect)
|
66 | {
|
67 | return;
|
68 | }
|
Wie bring ich den Watchdog dazu, nicht zu resetten?
Vielleicht ist die Antwort total simpel, ich hab allerdings wirklich
schon das Forum durchsucht und nichts brauchbares gefunden.
Danke schonmal...
Andi