发布者: 未知 来源:网络
org 0000h
ajmp START/*转主程序*/
org 0030h/*程序从0030H开始*/
start: mov dptr,#tab/*使数据指针指向TAB的开头*/
loop: clr a/*清累加器*/
movc a,@a+dptr/*从TAB中取出数据*/
cjne a,#0ah,a1/*取到结束码吗,不是则跳A1*/
ajmp start/*跳到开始*/
a1: cpl a/*将数据反相*/
mov p0,a/*将数据输出*/
loop2: acall delay/*延时200MS*/
inc dptr/*数据指针加1*/
ajmp loop
delay: mov r5,#14h /*200MS*/
dl1: mov r6,#14h /*10MS*/
dl2: mov r7,#0fah
djnz r7,$
djnz r6,dl2
djnz r5,dl1
ret
tab: db 01h,02h,04h,08h /*左移*/
db 10h,20h,40h,80h
db 01h,02h,04h,08h /*左移*/
db 10h,20h,40h,80h
db 80h,40h,20h,10h/*右移*/
db 08h,04h,02h,01h
db 80h,40h,20h,10h/*右移*/
db 08h,04h,02h,01h
db 00h,0ffh,00h,0ffh/*闪动*/
db 0aH /*结束码*/
end