SHARE
TWEET

Untitled

a guest Feb 27th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; uppgift 1.asm
  3. ;
  4. ; Created: 2020-02-27 08:37:57
  5. ; Author : eko15lj1
  6. ;
  7.  
  8. #define DDRB    0x04
  9. #define PORTB   0x05
  10. #define LED0    0
  11.  
  12. ; Replace with your application code
  13. start:
  14.     ldi r18, (4 << LED0)
  15.     in r17, DDRB
  16.     or r17, r18
  17.     out DDRB, r18
  18.  
  19.     in r17, PORTB
  20.     or r17, r18
  21.     out PORTB, r18
  22.  
  23.     ; 5hz
  24.     /* ldi r19, 9
  25.     ldi r20, 30
  26.     ldi r21, 229*/
  27.     ;1hz
  28.     /*ldi r19, 41
  29.     ldi r20, 150
  30.     ldi r21, 128
  31.     call L1*/
  32.     rjmp delay
  33.  
  34.     off:
  35.     ldi r18, (LED0 << 8)
  36.     out PORTB, r18
  37.    
  38.     /*; 5hz
  39.      ldi r19, 9
  40.     ldi r20, 30
  41.     ldi r21, 229*/
  42.     ;1hz
  43. /*  ldi r19, 41
  44.     ldi r20, 150
  45.     ldi r21, 128
  46.     call L1*/
  47.     call delay
  48.     rjmp end
  49.  
  50.     delay:
  51.         ldi r19, 81
  52.         loop1:
  53.             ldi r20, 81
  54.             loop2:
  55.                 ldi r21, 81
  56.                 loop3:
  57.                     dec r21
  58.                     brne loop3
  59.                 dec r20
  60.                 brne loop2
  61.             dec r19
  62.             brne loop1
  63.         rjmp off
  64.  
  65.  
  66.     end:
  67.         rjmp start
  68.  
  69.     /*  L1:
  70.         ;dec r21
  71.         ;b;rne L1
  72.         ;dec r20
  73.         ;brne L1
  74.         dec r19
  75.         brne L1
  76.         ret*/
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