TI中文支持网
TI专业的中文技术问题搜集分享网站

关于28377d 16位AD采样问题

我想使用定时器中断触发16位AD采样,一次触发对三相电压、三相电路分别进行采样转换,我的配置如下:

void ConfigureADC(void)
{
EALLOW;

//write configurations
AdcaRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4 ADCCLK = Input Clock / x
AdcbRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4 AD转换时钟
AdccRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4
AdcdRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4

AdcSetMode(ADC_ADCA, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 
AdcSetMode(ADC_ADCB, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 
// AdcSetMode(ADC_ADCC, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 
AdcSetMode(ADC_ADCD, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 

AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1; /

AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1; 

DELAY_US(1000); 

EDIS;
}

void SetupADCtimer0(void)
{
Uint16 acqps = 64; 
/*
//determine minimum acquisition window (in SYSCLKS) based on resolution
if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
{
acqps = 14; // 75ns 采样保持时间
}
else
{
acqps = 80; // 320ns resolution is 16-bit
}
*/
EALLOW; // Select the channels to convert and end of conversion flag

/*******************************************************************************/
/* */
/* ADC-A */
/* */
/*******************************************************************************/
/*
AdcaRegs.ADCBURSTCTL.bit.BURSTEN = 1; 
AdcaRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1; 
AdcaRegs.ADCBURSTCTL.bit.BURSTSIZE = 15;
*/
AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0;
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC0CTL.bit.CHSEL = 1; 
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC1CTL.bit.CHSEL = 2;
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

AdcaRegs.ADCSOC1CTL.bit.CHSEL = 3; 
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC2CTL.bit.CHSEL = 4; 
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC2CTL.bit.CHSEL = 5; 
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 5;
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; 
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;

/*******************************************************************************/
/* */
/* ADC-B */
/* */
/*******************************************************************************/

// AdcbRegs.ADCBURSTCTL.bit.BURSTEN = 1; 
// AdcbRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTSIZE = 2; 

AdcbRegs.ADCSOC0CTL.bit.CHSEL = 0; 
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcbRegs.ADCSOC0CTL.bit.CHSEL = 1;
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcbRegs.ADCSOC1CTL.bit.CHSEL = 2; 
AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 1; 

AdcbRegs.ADCSOC1CTL.bit.CHSEL = 3;
AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

AdcbRegs.ADCSOC2CTL.bit.CHSEL = 14;
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1;

AdcbRegs.ADCSOC2CTL.bit.CHSEL = 15; 
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1; 

// AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 0; 
// AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1; 
// AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; 

/*******************************************************************************/
/* */
/* ADC-D */
/* */
/*******************************************************************************/

// AdcdRegs.ADCBURSTCTL.bit.BURSTEN = 1; 
// AdcdRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1; 
// AdcdRegs.ADCBURSTCTL.bit.BURSTSIZE = 2;

AdcdRegs.ADCSOC0CTL.bit.CHSEL = 0; 
AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcdRegs.ADCSOC0CTL.bit.TRIGSEL = 1;

AdcdRegs.ADCSOC0CTL.bit.CHSEL = 1; 
AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcdRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcdRegs.ADCSOC1CTL.bit.CHSEL = 2; 
AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcdRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

AdcdRegs.ADCSOC1CTL.bit.CHSEL = 3; 
AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcdRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

// AdcdRegs.ADCINTSEL1N2.bit.INT1SEL = 0;
// AdcdRegs.ADCINTSEL1N2.bit.INT1E = 1; 
// AdcdRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; 

/*******************************************************************************/
/* */
/* ADC-interrupt configuration */
/* */
/*******************************************************************************/

// AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
// AdcaRegs.ADCINTSEL1N2.bit.INT2E = 0; // disable INT2 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT3E = 0; // disable INT3 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT4E = 0; // disable INT4 flag

AdcaRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdcaRegs.ADCINTSEL1N2.bit.INT2CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT3CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT4CONT = 0;

AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // make sure INT1 flag is cleared

EDIS;
}

AD结果寄存器值分别为49234 49426 49362,使用3V电压基准,通道实际电压为分压后的1.5V,像49426换算后结果已经到1.525V,存在很大偏差,我想确认上面的配置方法是否正确,如果不对应该如何配置?为什么采样结果误差很大(采样通道没有任何外接滤波电路),谢谢!

HeiHei:

这个问题不能单纯的从软件去找原因,还与你的外部电路设计有很大的关系,建议你把电路也贴出来 另外你用的是哪几个ad通道

我想使用定时器中断触发16位AD采样,一次触发对三相电压、三相电路分别进行采样转换,我的配置如下:

void ConfigureADC(void)
{
EALLOW;

//write configurations
AdcaRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4 ADCCLK = Input Clock / x
AdcbRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4 AD转换时钟
AdccRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4
AdcdRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4

AdcSetMode(ADC_ADCA, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 
AdcSetMode(ADC_ADCB, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 
// AdcSetMode(ADC_ADCC, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 
AdcSetMode(ADC_ADCD, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 

AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1; /

AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1; 

DELAY_US(1000); 

EDIS;
}

void SetupADCtimer0(void)
{
Uint16 acqps = 64; 
/*
//determine minimum acquisition window (in SYSCLKS) based on resolution
if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
{
acqps = 14; // 75ns 采样保持时间
}
else
{
acqps = 80; // 320ns resolution is 16-bit
}
*/
EALLOW; // Select the channels to convert and end of conversion flag

/*******************************************************************************/
/* */
/* ADC-A */
/* */
/*******************************************************************************/
/*
AdcaRegs.ADCBURSTCTL.bit.BURSTEN = 1; 
AdcaRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1; 
AdcaRegs.ADCBURSTCTL.bit.BURSTSIZE = 15;
*/
AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0;
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC0CTL.bit.CHSEL = 1; 
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC1CTL.bit.CHSEL = 2;
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

AdcaRegs.ADCSOC1CTL.bit.CHSEL = 3; 
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC2CTL.bit.CHSEL = 4; 
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC2CTL.bit.CHSEL = 5; 
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 5;
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; 
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;

/*******************************************************************************/
/* */
/* ADC-B */
/* */
/*******************************************************************************/

// AdcbRegs.ADCBURSTCTL.bit.BURSTEN = 1; 
// AdcbRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTSIZE = 2; 

AdcbRegs.ADCSOC0CTL.bit.CHSEL = 0; 
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcbRegs.ADCSOC0CTL.bit.CHSEL = 1;
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcbRegs.ADCSOC1CTL.bit.CHSEL = 2; 
AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 1; 

AdcbRegs.ADCSOC1CTL.bit.CHSEL = 3;
AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

AdcbRegs.ADCSOC2CTL.bit.CHSEL = 14;
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1;

AdcbRegs.ADCSOC2CTL.bit.CHSEL = 15; 
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1; 

// AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 0; 
// AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1; 
// AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; 

/*******************************************************************************/
/* */
/* ADC-D */
/* */
/*******************************************************************************/

// AdcdRegs.ADCBURSTCTL.bit.BURSTEN = 1; 
// AdcdRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1; 
// AdcdRegs.ADCBURSTCTL.bit.BURSTSIZE = 2;

AdcdRegs.ADCSOC0CTL.bit.CHSEL = 0; 
AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcdRegs.ADCSOC0CTL.bit.TRIGSEL = 1;

AdcdRegs.ADCSOC0CTL.bit.CHSEL = 1; 
AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcdRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcdRegs.ADCSOC1CTL.bit.CHSEL = 2; 
AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcdRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

AdcdRegs.ADCSOC1CTL.bit.CHSEL = 3; 
AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcdRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

// AdcdRegs.ADCINTSEL1N2.bit.INT1SEL = 0;
// AdcdRegs.ADCINTSEL1N2.bit.INT1E = 1; 
// AdcdRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; 

/*******************************************************************************/
/* */
/* ADC-interrupt configuration */
/* */
/*******************************************************************************/

// AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
// AdcaRegs.ADCINTSEL1N2.bit.INT2E = 0; // disable INT2 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT3E = 0; // disable INT3 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT4E = 0; // disable INT4 flag

AdcaRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdcaRegs.ADCINTSEL1N2.bit.INT2CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT3CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT4CONT = 0;

AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // make sure INT1 flag is cleared

EDIS;
}

AD结果寄存器值分别为49234 49426 49362,使用3V电压基准,通道实际电压为分压后的1.5V,像49426换算后结果已经到1.525V,存在很大偏差,我想确认上面的配置方法是否正确,如果不对应该如何配置?为什么采样结果误差很大(采样通道没有任何外接滤波电路),谢谢!

user4397061:

回复 HeiHei:

我使用的是176引脚28377芯片,A0-A5采样三路信号,B0-B3,14、15六个通道采样三路信号,运放调理后信号直接进入AD采样,使用万用表测量过电压值,是通过电压基准分压得到的1.5V,我是希望明确排除软件配置导致问题的可能性,这样我可以专心从其他方面寻找原因。

我想使用定时器中断触发16位AD采样,一次触发对三相电压、三相电路分别进行采样转换,我的配置如下:

void ConfigureADC(void)
{
EALLOW;

//write configurations
AdcaRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4 ADCCLK = Input Clock / x
AdcbRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4 AD转换时钟
AdccRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4
AdcdRegs.ADCCTL2.bit.PRESCALE = 6; // set ADCCLK divider to /4

AdcSetMode(ADC_ADCA, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 
AdcSetMode(ADC_ADCB, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 
// AdcSetMode(ADC_ADCC, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 
AdcSetMode(ADC_ADCD, ADC_RESOLUTION_16BIT, ADC_SIGNALMODE_DIFFERENTIAL); 

AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcdRegs.ADCCTL1.bit.INTPULSEPOS = 1; /

AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;
AdcdRegs.ADCCTL1.bit.ADCPWDNZ = 1; 

DELAY_US(1000); 

EDIS;
}

void SetupADCtimer0(void)
{
Uint16 acqps = 64; 
/*
//determine minimum acquisition window (in SYSCLKS) based on resolution
if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
{
acqps = 14; // 75ns 采样保持时间
}
else
{
acqps = 80; // 320ns resolution is 16-bit
}
*/
EALLOW; // Select the channels to convert and end of conversion flag

/*******************************************************************************/
/* */
/* ADC-A */
/* */
/*******************************************************************************/
/*
AdcaRegs.ADCBURSTCTL.bit.BURSTEN = 1; 
AdcaRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1; 
AdcaRegs.ADCBURSTCTL.bit.BURSTSIZE = 15;
*/
AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0;
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC0CTL.bit.CHSEL = 1; 
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC1CTL.bit.CHSEL = 2;
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

AdcaRegs.ADCSOC1CTL.bit.CHSEL = 3; 
AdcaRegs.ADCSOC1CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC2CTL.bit.CHSEL = 4; 
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCSOC2CTL.bit.CHSEL = 5; 
AdcaRegs.ADCSOC2CTL.bit.ACQPS = acqps; 
AdcaRegs.ADCSOC2CTL.bit.TRIGSEL = 1; 

AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 5;
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; 
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;

/*******************************************************************************/
/* */
/* ADC-B */
/* */
/*******************************************************************************/

// AdcbRegs.ADCBURSTCTL.bit.BURSTEN = 1; 
// AdcbRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1;
// AdcbRegs.ADCBURSTCTL.bit.BURSTSIZE = 2; 

AdcbRegs.ADCSOC0CTL.bit.CHSEL = 0; 
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcbRegs.ADCSOC0CTL.bit.CHSEL = 1;
AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcbRegs.ADCSOC1CTL.bit.CHSEL = 2; 
AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 1; 

AdcbRegs.ADCSOC1CTL.bit.CHSEL = 3;
AdcbRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

AdcbRegs.ADCSOC2CTL.bit.CHSEL = 14;
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps;
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1;

AdcbRegs.ADCSOC2CTL.bit.CHSEL = 15; 
AdcbRegs.ADCSOC2CTL.bit.ACQPS = acqps; 
AdcbRegs.ADCSOC2CTL.bit.TRIGSEL = 1; 

// AdcbRegs.ADCINTSEL1N2.bit.INT1SEL = 0; 
// AdcbRegs.ADCINTSEL1N2.bit.INT1E = 1; 
// AdcbRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; 

/*******************************************************************************/
/* */
/* ADC-D */
/* */
/*******************************************************************************/

// AdcdRegs.ADCBURSTCTL.bit.BURSTEN = 1; 
// AdcdRegs.ADCBURSTCTL.bit.BURSTTRIGSEL = 1; 
// AdcdRegs.ADCBURSTCTL.bit.BURSTSIZE = 2;

AdcdRegs.ADCSOC0CTL.bit.CHSEL = 0; 
AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcdRegs.ADCSOC0CTL.bit.TRIGSEL = 1;

AdcdRegs.ADCSOC0CTL.bit.CHSEL = 1; 
AdcdRegs.ADCSOC0CTL.bit.ACQPS = acqps; 
AdcdRegs.ADCSOC0CTL.bit.TRIGSEL = 1; 

AdcdRegs.ADCSOC1CTL.bit.CHSEL = 2; 
AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcdRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

AdcdRegs.ADCSOC1CTL.bit.CHSEL = 3; 
AdcdRegs.ADCSOC1CTL.bit.ACQPS = acqps; 
AdcdRegs.ADCSOC1CTL.bit.TRIGSEL = 1;

// AdcdRegs.ADCINTSEL1N2.bit.INT1SEL = 0;
// AdcdRegs.ADCINTSEL1N2.bit.INT1E = 1; 
// AdcdRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; 

/*******************************************************************************/
/* */
/* ADC-interrupt configuration */
/* */
/*******************************************************************************/

// AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
// AdcaRegs.ADCINTSEL1N2.bit.INT2E = 0; // disable INT2 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT3E = 0; // disable INT3 flag
// AdcaRegs.ADCINTSEL3N4.bit.INT4E = 0; // disable INT4 flag

AdcaRegs.ADCINTSEL1N2.bit.INT1CONT = 0;
AdcaRegs.ADCINTSEL1N2.bit.INT2CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT3CONT = 0;
AdcaRegs.ADCINTSEL3N4.bit.INT4CONT = 0;

AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // enable INT1 flag
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // make sure INT1 flag is cleared

EDIS;
}

AD结果寄存器值分别为49234 49426 49362,使用3V电压基准,通道实际电压为分压后的1.5V,像49426换算后结果已经到1.525V,存在很大偏差,我想确认上面的配置方法是否正确,如果不对应该如何配置?为什么采样结果误差很大(采样通道没有任何外接滤波电路),谢谢!

user5029276:

回复 user4397061:

你好。找到问题的原因了么。能分享一下解决方案么。

赞(0)
未经允许不得转载:TI中文支持网 » 关于28377d 16位AD采样问题
分享到: 更多 (0)