__ASM void outdac2(int16 n)
{
PUSH {r4,lr}
MOVS r1,#0x80
LSLS R1,R1,#8
LSLS r0,r0,#16
MOVS r4,#0x1F //;DA_CLK_HIGN
LSLS r4,r4,#27
LOOP05
MOVS r3,#0x20
STR r3,[r4,#0x04] //;DA_CLK_HIGH
LSLS r0,r0,#1
BCC LOOP10 //;0=SKIP
MOVS r3,#0x02
STR r3,[r4,#0x04] //;DA_DAT_HIGH;
B LOOP20
LOOP10
MOVS r3,#0x02
STR r3,[r4,#0x08] //;DA_DAT_LOW;
LOOP20
MOVS r3,#0x20
STR r3,[r4,#0x08] //;DA_CLK_LOW;
LSRS R1,R1,#1
BCC LOOP05
STR r3,[r4,#0x04] //;DA_CLK_HIGH;
POP {r4,pc}
}
发完16bit,用了6.23us,时钟速度提高一倍,感谢QQ群里用户:2008不服不行
|