SHARE
TWEET

Banu

a guest Oct 16th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; Aufgabe1.asm
  3. ;
  4. ; Created: 16.10.2019 08:37:24
  5. ; Author : bs6247s
  6. ;
  7.  
  8.  
  9. ; Replace with your application code
  10.  
  11.  
  12.  
  13. .def temp =r16
  14. .def ledstatus = r17
  15. .def counter = r18
  16.  
  17. .org 0x0000
  18.     rjmp main                ;Reset Handler
  19. .org OVF0addr
  20. rjmp timer0_overflow         ; Adresse für timer overflow Handler
  21.  
  22. main:
  23.  
  24. ;Stackpointer initialisieren
  25. ldi temp, HIGH(RAMEND)
  26. out SPH, temp
  27. ldi temp, LOW(RAMEND)
  28. out SPL, temp
  29.  
  30. ldi temp, 0xFF  
  31. out DDRC, temp
  32.  
  33. ldi temp, 0xFF  
  34. out DDRB, temp
  35.  
  36. ldi temp, 0xFF  
  37. out DDRD, temp
  38.  
  39.  
  40. ldi ledstatus, 0xFF
  41. ldi counter, 0
  42.  
  43. rcall timer
  44. rcall delay
  45.  
  46. loop:
  47.  
  48.     rjmp loop
  49.  
  50. timer:
  51.  
  52. in temp, TCCR0
  53. cbr temp,0b00000111
  54. sbr temp, 0b00000101
  55. out TCCR0, temp
  56.  
  57. ldi temp, (1<<TOIE0)
  58. out TIMSK, temp
  59.  
  60. sei
  61. ret
  62.  
  63. timer0_overflow:
  64.  
  65. inc counter
  66. cpi counter, 8
  67. brlo endSub
  68.  
  69. out PORTC, ledstatus
  70. com ledstatus
  71. ldi counter, 0
  72.  
  73. delay:
  74.  
  75.  
  76. endSub:
  77. reti
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top