想用F2812的gpio口模拟一个通信信号,对频率一致性要求很严格,目前直接用C语言写的方式是:
GpioDataRegs.GPDDAT.all = period;
period &= 0x62;
asm("RPT #31 || NOP");
GpioDataRegs.GPDDAT.all = period;
period |= 0x1;
asm("RPT #31 || NOP");
其中period 是一个unsigned int 的变量,用CCS查看了反汇编出来的汇编代码,发现编译器会随机在上下两条GPIO中插入数量不等汇编指令,造成最终输出的信号频率一致性比较差,有的长有的短,但是我又不懂DSP的汇编言语,求大神告诉我这四条指令:
“ GpioDataRegs.GPDDAT.all = period;
period &= 0x62;
GpioDataRegs.GPDDAT.all = period;
period |= 0x1;“
用汇编怎么内嵌编写。
这里贴上ccs反汇编的代码:
"AND AL, *+XAR4[1], #0xff"
"MOV @0x2c, AH"
"RPT #31 || NOP"
"ANDB AH, #0x62"
"MOV @0x2c, AH"
"RPT #31 || NOP"
"MOVW DP, #0xfe46"
"AND AL, @0x27, #0xff00"
"MOVW DP, #0x1c3"
"OR AL, @AH"
"MOV AH, @AL"
"LSR AH, 8"
"MOV @0x2c, AH"
"RPT #31 || NOP"
"ANDB AH, #0x62"
"ORB AL, #0x1"
"MOVB AL.MSB, @AH"
"OR @AL, #0x0100"
"MOV @0x2c, AH"
"MOVW DP, #0xfe46"
"MOV @0x27, AL"
"RPT #31 || NOP"
"MOVW DP, #0x1c3"
"AND AH, *+XAR4[2], #0xff"
"MOV @0x2c, AH"
"RPT #31 || NOP"
"ANDB AH, #0x62"
"MOV @0x2c, AH"
"RPT #31 || NOP"
"MOVW DP, #0xfe46"
"AND AL, @0x28, #0xff00"
"MOVW DP, #0x1c3"
"OR AL, @AH"
"MOV AH, @AL"
"LSR AH, 8"
"MOV @0x2c, AH"
"RPT #31 || NOP"
"ANDB AH, #0x62"
"ORB AL, #0x1"
"MOVB AL.MSB, @AH"
"OR @AL, #0x0100"
"MOV @0x2c, AH"
"MOVW DP, #0xfe46"
"MOV @0x28, AL"
"RPT #31 || NOP"
"MOVW DP, #0x1c3"
"AND AH, *+XAR4[3], #0xff"
"MOV @0x2c, AH"
"RPT #31 || NOP"
"ANDB AH, #0x62"
"MOV @0x2c, AH"
"RPT #31 || NOP"
"MOVW DP, #0xfe46"
"AND AL, @0x29, #0xff00"
"MOVW DP, #0x1c3"
"OR AL, @AH"
"MOV AH, @AL"
"LSR AH, 8"
"MOV @0x2c, AH"
"RPT #31 || NOP"
"ANDB AH, #0x62"
"ORB AL, #0x1"
"MOVB AL.MSB, @AH"
"OR @AL, #0x0100"
"MOV @0x2c, AH"
"RPT #31 || NOP"