Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .include "m64def.inc"
- jmp init ;jmp to init procedure
- loop: ;chack btn state
- sbis pind, 6 ; if btn isn't pressed, then skip next cmd
- rcall inc_cnt
- jmp loop;
- init:
- ldi r16, low(ramend)
- ldi r17, high(ramend)
- out spl, r16
- out sph, r17
- ldi r16, 0x0F
- out ddrc, r16
- jmp loop
- inc_cnt:
- ldi r20, 0x01 ; load 0x01 for increment value into r31 (used as counter for output)
- add r31, r20 ;add ones value with our counter value into r31
- andi r31, 0x0F ;get bitmsk for counter
- out portc, r31 ;get out value into portc
- loop_1: ;check btn for unpressed state
- sbic pind, 6;check btn for unpressed stated
- ret ;if btn is unpressed, make jmp to the rcall part of code (pc+1)
- jmp loop_1 ;if btn is pressed, polling state again
Advertisement
Add Comment
Please, Sign In to add comment