AtMega162 - SRAM funktioniert nicht richtig?

Gast #539487
Lesenswert?

Hallo,
hab an PortC 8 LEDs angeschlossen und möchte sie gerne wie (im SRAM 
gespeichert) blinken lassen. Leider Blinkt immer nur eine LED.
Wo ist da der Fehler?
1
.include  "m162def.inc"
2

3
.def  temp    = r16
4

5
begin:
6
  rjmp  main
7

8

9
main:
10

11
;Stack-Einrichtung
12
  ldi  temp,low(RAMEND)
13
  out  SPL,temp
14
  ldi  temp,high(RAMEND)
15
  out  SPH,temp
16
  
17
  ;___________________________________________________________________
18

19
;I/O-Konfiguration
20

21
  ldi  temp,0xFF
22
  out  DDRC,temp        ;PORTC auf Ausgang
23

24
  ;___________________________________________________________________
25

26
;SRAM beladen
27
  ldi  temp,0b11111101
28
  STS  0x0060,temp
29

30
  ldi  temp,0b00010001
31
  STS  0x0061,temp
32

33
  ldi  temp,0b10101010
34
  STS  0x0062,temp
35

36
  ldi  temp,0x7E
37
  STS  0x0063,temp
38

39

40

41
;---------------------------------------------------------------------------------------------------------------
42
mainloop:
43
  
44
  wdr
45

46
  lds  temp,0x0060
47
  out  portc, temp
48

49
  rcall pause
50

51

52

53
  lds  temp,0x0061
54
  out  portc, temp
55

56
  rcall pause
57

58

59
    
60
  lds  temp,0x0062
61
  out  portc, temp
62

63
  rcall pause
64

65

66

67
  lds  temp,0x0063
68
  out  portc, temp
69

70
  rjmp  mainloop
71
;---------------------------------------------------------------------------------------------------------------
72

73

74

75
pause:
76

77
Wait_3s:
78
   push   r16
79
   ldi   r16,122
80
Wait_3s_3:
81
   push   r16
82
   ldi   r16,255
83
Wait_3s_2:
84
   push   r16
85
   ldi   r16,255
86
Wait_3s_1:
87
   dec   r16   
88
   brne   Wait_3s_1
89
   pop   r16
90
   dec   r16   
91
   brne   Wait_3s_2
92
   pop   r16
93
   dec   r16   
94
   brne   Wait_3s_3
95
   pop   r16
96
   ret

  

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