Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Bit-shifting done here!!!!!
- ldi r22, 1 ;this register will store the data that will be put into portc
- ldi r23, 128 ;this is the upper-limit
- ldi r24, 1 ;this is the lower-limit
- port_loop_left: ;loop to shift the bit all the way to the left
- out portc, r22 ;put current value of r22 in portc
- lsl r22 ;shift the bit left one
- cpse r22, r23 ;has r22 reached the upper-limit of the bitshift? If y, skip next step
- rjmp port_loop_left
- port_loop_right: ;loop to shift the bit all the way to the right
- lsr r22 ;shift the bit to the right by one. Do this first because the bit is already at the left-most location
- out portc, r22 ;put the value of r22 into portc
- cpse r22, r24 ;has r22 reached the lower limit of the bit-shift possibility? if so, skip next command
- rjmp port_loop_right
- nop
- rjmp port_loop_left ;return to the loop that shifts the bit left. REPEAT FOREVAR!!!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement