licht_attiny_test.asm


1
.nolist
2
.include <tn2313def.inc>
3
.list
4
.cseg
5
.def zahl=r18
6
.def temp=r16
7
.def sregsave=r19
8
.def tmp=r21
9
.org 0x000  
10
11
12
      rjmp RESET
13
         rjmp RESET
14
      rjmp RESET
15
      rjmp RESET
16
      rjmp RESET
17
      rjmp RESET
18
      rjmp RESET
19
      rjmp Licht_80s
20
      rjmp RESET
21
      rjmp RESET
22
      rjmp RESET
23
      rjmp RESET
24
      rjmp RESET
25
      rjmp RESET
26
reset:  
27
  
28
    ldi zahl,1        ;legt die anzahl der umläufe fe          
29
      ldi temp, low(ramend)  ;stackpointer initialisiert
30
      out spl, temp  
31
    ldi temp,0b11111111    ; portb ist ausgang
32
    out ddrb,temp      
33
    ldi temp,0b00000000
34
    out ddrd,temp      ;portd ist eingang    
35
    ldi Temp, 2        ;hier wird der timer interupt freigegeben
36
    out TIMSK, Temp  
37
    sei
38
    ldi temp,5
39
    out TCCR0,temp      ; mit 1024 geteilte frequenz
40
  
41
timer:  ldi tmp , 255
42
     out TCNT0, tmp      ;timer zählt bis 255
43
    ldi temp,0
44
    cp zahl,temp
45
    breq licht_aus
46
    rjmp timer
47
            
48
             
49
50
licht_aus:
51
           ldi temp,0b11111111
52
       out portb,temp
53
       rjmp ende
54
55
  
56
Licht_80s:
57
58
      in sregsave ,SREG 
59
      push sregsave
60
      dec zahl
61
      pop sregsave
62
      out SREG,sregsave
63
      reti
64
65
66
ende:  
67
    
68
    rjmp ende
69
         
70
        
71
;timer: ldi tmp , 255
72
;out TCNT0, tmp ;timer zählt bis 255
73
;timer1:
74
;ldi temp,0
75
;cp zahl,temp
76
;breq licht_aus
77
;rjmp timer1