Ich hab mal mit nem PIC rumgespielt, da kam ich im Sleep-Modus auf 60uA.
Eigentlich sollte das mit dem 1284P auch möglich sein - aber irgendwie
will's nicht so recht. Ich messe bei 5V/16MHz ca 16mA. Die Harware ist
leergeräumt. Hab ich was vergessen? Liegt's an dem hohen Takt?
1 | C-Code
|
2 |
|
3 | /************************************************************************
|
4 | *
|
5 | * ISR INT2_vect for Mega 1284P
|
6 | *
|
7 | *************************************************************************/
|
8 | ISR( INT2_vect ) {
|
9 | PORTD ^= (1 << PORTD5); //DEBUG + wake-up?
|
10 | _delay_ms(1000);
|
11 |
|
12 | }
|
13 |
|
14 | int main(void)
|
15 | {
|
16 | //init
|
17 | flagResolverActive = 0;
|
18 | PORTC |= (1 << reset); // preset reset
|
19 | DDRC |= (1 << DDC2); // reset
|
20 |
|
21 | PORTC &= ~(1 << I2CMode); // preset I2C mode
|
22 | DDRC |= (1 << DDC3); // /I2C mode
|
23 |
|
24 |
|
25 | DDRC |= (1 << DDC5); // extended LED upper
|
26 | DDRD |= (1 << DDD4); // LED middle
|
27 | DDRD |= (1 << DDD5); // LED lower
|
28 |
|
29 | PORTB |= (1 << buttonLeft); // pull-up
|
30 | DDRB &= ~(1 << DDB1); // button
|
31 |
|
32 | PORTB |= (1 << buttonRight); // pull-up
|
33 | DDRB &= ~(1 << DDB0); // button
|
34 |
|
35 | PORTA |= (1 << buttonResolver); // pull-up
|
36 | DDRA &= ~(1 << DDA1); // button
|
37 |
|
38 | PORTB |= (1 << PORTB2); // INT2 pin-change wake-up
|
39 | DDRB &= ~(1 << DDB2); //
|
40 |
|
41 |
|
42 |
|
43 | #define STEP while (PINB & 1<<PINB0); \
|
44 | PORTD ^= (1 << PORTD4); \
|
45 | _delay_ms(1000); \
|
46 | PORTD ^= (1 << PORTD4)
|
47 |
|
48 |
|
49 | //---------------------------------------------------------------------------------
|
50 | //this is where the fun begins
|
51 | // Energy save
|
52 | /*
|
53 | SM2 SM1 SM0 Sleep Mode
|
54 | 0 0 0 Idle
|
55 | 0 0 1 ADC Noise Reduction
|
56 | 0 1 0 Power-down
|
57 | 0 1 1 Power-save
|
58 | 1 0 0 Reserved
|
59 | 1 0 1 Reserved
|
60 | 1 1 0 Standby(1)
|
61 | 1 1 1 Extended Standby(1)
|
62 | */
|
63 |
|
64 | EICRA = 1 << ISC21; // INT2 falling edge
|
65 | EIMSK = 1 << INT2; // INT enable
|
66 | sei();
|
67 |
|
68 | STEP;
|
69 | PRR1 = 1 << PRTIM3;
|
70 | PRR0 = 0xFF;
|
71 |
|
72 |
|
73 | STEP;
|
74 | SMCR |= (1 << SE) ;
|
75 | SMCR |= (1 << SM0);
|
76 | SMCR |= (1 << SM1);
|
77 | SMCR |= (1 << SM2);
|
78 |
|
79 | while (1);
|
80 |
|
81 | }
|