Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; ErsteAsmSchritte.asm
  3. ;
  4. ; Created: 19.10.2017 14:54:38
  5. ; Author : Jan
  6. ;
  7. .def temp       = R16
  8.  
  9.  
  10. .org 0x002E rjmp int0Ovfl
  11.  
  12. .ORG INT_VECTORS_SIZE       ; End of interrupt table
  13.  
  14. .equ LED_DDR    = DDRB
  15. .equ LED_PORT   = PORTB
  16.  
  17. int0Ovfl:
  18.     cbi LED_PORT,7
  19.     reti
  20.  
  21. init:
  22.     sbi LED_DDR,7 // set pin as out
  23.     ret
  24.  
  25. initTim0:
  26.     ldi temp, (1<<CS02) | (1<<CS01) // prescaler 1024 -> TCCR0B
  27.     out TCCR0B,temp // write to TCCR0B
  28.     ldi temp, (1<<TOIE0) // timer overflow enable -> TIMSK0
  29.     sts TIMSK0,temp // write to TIMSK0
  30.     sei // enable interrupts
  31.  
  32.     ret
  33.  
  34. ; Replace with your application code
  35. main:
  36.  
  37.     call init
  38.     call initTim0
  39.  
  40.     rjmp main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement