我在ADC初始化程序里加了一句汇编指令,
asm("RPT #10 || NOP"); 可是编译一直显示有错误,但我把该指令改为
asm(”NOP");编译可以通过,但会有警告。实在不知道错误出在哪里了,有没有大神能指点一下啊,下面是出错的截图。
初始化程序:
void InitAdc(void)
{
extern void DSP28x_usDelay(Uint32 Count);
// To powerup the ADC the ADCENCLK bit should be set first to enable
// clocks, followed by powering up the bandgap and reference circuitry.
// After a 5ms delay the rest of the ADC can be powered up. After ADC
// powerup, another 20us delay is required before performing the first
// ADC conversion. Please note that for the delay function below to
// operate correctly the CPU_CLOCK_SPEED define statement in the
// DSP28_Examples.h file must contain the correct CPU clock period in
// nanoseconds. For example:
AdcRegs.ADCTRL3.all = 0x0100; // Set bit 8 high to enable external设置ADC外部的参考基准。
// ADCREFP/REFM sourcing
// See Note 1.
asm("RPT #10 || NOP"); // Time to enable of external ref asm(” rpt #10 || nop”);
AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3; // Power up bandgap/reference circuits
DELAY_US(ADC_usDELAY); // Delay before powering up ADC
// See Note 2.
AdcRegs.ADCTRL3.bit.ADCPWDN = 1; // Power up rest of ADC
DELAY_US(ADC_usDELAY2); // Delay after powering up ADC
AdcRegs.ADCTRL1.bit.SUSMOD = 3;
//AdcRegs。ADCTRL1.bit.SUSMOD
//双序列并发采样
AdcRegs.ADCTRL1.bit.SEQ_CASC = 0;
AdcRegs.ADCTRL3.bit.SMODE_SEL = 1;
AdcRegs.ADCMAXCONV.all = 0x0033;
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0;
AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1;
AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x2;
AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0x3;
AdcRegs.ADCCHSELSEQ3.bit.CONV08 = 0xc;
AdcRegs.ADCCHSELSEQ3.bit.CONV09 = 0xd;
AdcRegs.ADCCHSELSEQ3.bit.CONV10 = 0xe;
AdcRegs.ADCCHSELSEQ3.bit.CONV11 = 0xf;
}
此帖出自
小平头技术问答
一周热门 更多>