Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. .equ LED1 = 5
  2. .equ LED2 = 6
  3. .equ BUT1 = 2
  4. .equ BUT2 = 3
  5. .equ BUT3 = 4
  6.  
  7.  
  8.  
  9. init:
  10. ldi R16, 1<<LED1 | 1<<LED2 ;LED1 LED2 as output / BUT1 input
  11. out DDRD, R16
  12. ldi R16, 1<<BUT1 | 1<<BUT2 | 1<<BUT3 ;activate Pullups for buttons
  13. out PORTD, R16
  14.  
  15. loop:
  16. /* cbi PORTD, LED1
  17. sbis PIND, BUT1
  18. sbi PORTD, LED1
  19. rjmp loop*/
  20.  
  21. /* cbi PORTD, LED1 ;clear bit
  22. cbi PORTD, LED2
  23.  
  24. sbis PIND, BUT1 ;skip if bit set
  25. sbi PORTD, LED1 ;set bit
  26.  
  27. sbis PIND, BUT2
  28. sbi PORTD, LED2
  29.  
  30. rjmp loop*/
  31.  
  32. /* sbis PIND, BUT1
  33. sbi PIND, LED1 ;man kann PORTX toggeln indem man eine 1 an die entsprechende stelle im register schreibt
  34. rjmp loop*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement