stackpoiunter atmege16 und avr studio

Gast #2323459
Lesenswert?

Hallo ich habe einen komischen fehler:
wenn ich mit avr studio das programm simuliere kommt ein "AVR Simulator: 
Uninitialized stack pointer used at 0x0038" Fehler und das programm 
startet an igrendeiner stelle ... ich dachte immer das der stack pointer 
in C automatisch initialisiert wird, ist dem nicht so?


1
#include <avr/io.h>
2
#include <avr/interrupt.h>
3

4

5
void TIMER_Init();
6
void ADC_Init();
7
uint8_t hexadezimal(short zahl);
8
uint16_t ADC_Read();
9

10
uint16_t cnt = 0;
11

12

13
SIGNAL(SIG_OVERFLOW1) {
14
  uint8_t tmp;
15

16
  tmp = tmp;
17

18
  PORTB = hexadezimal(cnt++);
19
  PORTD = hexadezimal(cnt);
20

21
}
22

23

24
int main (void) {
25
  TIMER_Init();
26
  sei();
27

28
  DDRB = 0xff;
29
  DDRD = 0xff;
30

31
  return 0;
32
}
33

34

35
uint8_t hexadezimal(short zahl) {
36
  uint8_t port;
37

38
  switch(zahl) {  
39
      //          gfdecba 
40
    case 0:  port = 0b1000000; break;
41
    case 1:  port = 0b1111001; break;
42
    case 2: port = 0b0100100; break;
43
    case 3: port = 0b0101000; break;
44
    case 4: port = 0b0011001; break;
45
    case 5: port = 0b0001010; break;
46
    case 6: port = 0b0000010; break;
47
    case 7: port = 0b1111000; break;
48
    case 8: port = 0b0000000; break;
49
    case 9: port = 0b0001000; break;
50
    default:port = 0b0011110;
51
  }
52

53
  return port;
54
}
55

56
void TIMER_Init() {
57
    TCCR1B = 0x05;
58
  TIMSK |= (1<<TOIE1);
59
}

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren