Advertisement
Guest User

Untitled

a guest
Dec 8th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .def tmp = r16
  2. .def mask = r17
  3.  
  4. .cseg
  5.     rjmp reset
  6.  
  7. .org $00C
  8.     rjmp blink
  9.  
  10. .org $010
  11.     rjmp blink
  12.  
  13. reset:
  14.     ldi tmp, high(RAMEND)
  15.     out SPH, tmp
  16.     ldi tmp, low(RAMEND)
  17.     out SPL, tmp
  18.  
  19.     ldi tmp, 0x01
  20.     out PORTA, tmp
  21.     out DDRA,  tmp
  22.  
  23.     ldi mask, 0x01
  24.  
  25.     ldi tmp, (1 << WGM11) | (1 << WGM10)
  26.     out TCCR1A, tmp
  27.  
  28.     ldi tmp, (1 << WGM12) | (1 << WGM13) | (1 << CS11)
  29.     out TCCR1B, tmp
  30.  
  31.     ldi tmp, high(23039)
  32.     out OCR1AH, tmp
  33.     ldi tmp, low(23039)
  34.     out OCR1AL, tmp
  35.  
  36.     ldi tmp, high(10000)
  37.     out OCR1BH, tmp
  38.     ldi tmp, low(10000)
  39.     out OCR1BL, tmp
  40.  
  41.     ldi tmp, (1 << OCIE1A) | (1 << TOIE1)
  42.     out TIMSK, tmp
  43.  
  44.     sei
  45.  
  46. main:
  47. rjmp main
  48.  
  49. blink:
  50.     in tmp, PORTA
  51.     eor tmp, mask
  52.     out PORTA, tmp
  53.  
  54. reti
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement