本程序中运用的avr单片机是m16芯片,能够让8个led完成循环移位的作用/*
* loopLEDLight.asm
*
* Created: 2014/3/14 9:47:20
* Author: Wujie
*/
.include”m16def.inc”
.deftemp1=r20
.defcount=r17
.org$0000
rjmpmain
.org$002A
main:
ldir16,high(RAMEND)
outsph,r16
ldir16,low(RAMEND)
outspl,r16
sertemp1
outddrc,temp1
outportc,temp1
ldicount,0b01111111
ldir16,197
loop:
outportc,count
rcalldelay
rcallloopdis
rjmploop
;循环位移
loopdis:
ldir21,7;r21装入当即数7,后边或将count右移7位
pushcount;将count保存起来后边会运用
lslcount;将count左移一位
movr18,count;左位移一的当即数装入r18
popcount;复原count
dis:lsrcount;右位移7次count值改变为右移7次的值
decr21
brnedis
orcount,r18;左移一次与右移7次进行求或 即左循环一次
ret
delay:pushr16
del3:pushr16
del2: push r16
del1:decr16
brne del1
popr16
decr16
brne del2
popr16
decr16
brnedel3
popr16
ret
/*寄存器与寄存器直接的传递运用mov*/