DSP F2812在C语言代码中内嵌汇编语言控制GPIO操作 20C

我想用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"

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!