弄好了,好高兴哦
我弄出来了,程序是这样的: mode equ 082h contrl equ 08003h ctl equ 08000h astep equ 01h bstep equ 02h cstep equ 04h dstep equ 08h dsy_c equ 60h org 0000h ljmp step org 0030h step: mov a,#mode mov dptr,#contrl movx @dptr,a mov a,#0 mov dptr,#08002h movx @dptr,a mov dsy_c,#0ah ljmp loop1/ loop2/ loop3 ;三个通道 loop1: mov dptr,#ctl ;单/八拍 A_AB-B_BC_C_CD_D_DA mov a,#step movx @dptr,a call delay mov a,#astep+bstep movx @dptr,a call delay mov a,#bstep movx @dptr,a call delay mov a,#bstep+cstep movx @dptr,a call delay mov a,#cstep movx @dptr,a call delay mov a,#cstep+dstep movx @dptr,a call delay mov a,#dstep movx @dptr,a call delay mov a,#dstep+astep movx @dptr,a call delay
mov a,dsy_c dec a cjne a,#1,lp1 inc a lp1: mov dsy_c,a ljmp loop1
loop2: mov dptr,#ctl ;双四拍 AB_BC_CD_DA mov a,#astep+bstep movx @dptr,a call delay mov a,#bstep+cstep movx @dptr,a call delay mov a,#cstep+dstep movx @dptr,a call delay mov a,#dstep+astep movx @dptr,a call delay
mov a,dsy_c dec a cjne a,#2,lp2 lp2: mov dsy_c,a ljmp loop2
loop3: ;单四拍 B_C_D_A mov dptr,#ctl mov a,#bstep movx @dptr,a call delay mov a,#cstep movx @dptr,a call delay mov a,#dstep movx @dptr,a call delay mov a,#astep movx @dptr,a call delay
mov a,dsy_c dec a cjne a,#3,lp3 lp3: mov dsy_c,a ljmp loop3
delay: mov r6,dsy_c delayloop: mov r7,#0 djnz r7,$ djnz r6,delayloop ret end |
|