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

DSP28035的ADC转换

大家好

         我最近在用28035进行ADC测试,使用官方F2803XILEG_VDC.H 头文件的ADC_MACRO_INIT宏,进行了一些修改如下,用定时器触发ADC转换,使用的是内部参考电压,但现在调试结果是输入低于1.4V电压没有采样值,高于1.4V才开始有采样值(从0开始)例如:输入1.8V,采样到1F5,换算后是0.4V(是把1.4当做起始值吗?),各位高手帮忙看看我的ADC初始化程序是不是错了,谢谢各位了。

 

#define ADC_MACRO_INIT(ChSel,Trigsel,ACQPS)              \
  asm(" RPT#100 || NOP");                                         \
                        \
    AdcRegs.ADCCTL1.all=ADC_RESET_FLAG;               \
 asm(" NOP ");                    \
 asm(" NOP ");                       \
                        \
 EALLOW;                      \
 AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; /* Power up band gap */        \
                        \
                                                                                  \
                            \
 AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; /*选择内部参考电压*/         \
    AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; /* Power up reference */       \
    AdcRegs.ADCCTL1.bit.ADCPWDN  = 1; /* Power up rest of ADC */       \
 AdcRegs.ADCCTL1.bit.ADCENABLE = 1; /* Enable ADC */         \
                        \
 asm(" RPT#100 || NOP");                                             \
                                                                                                \
 AdcRegs.ADCCTL1.bit.INTPULSEPOS= 1;  /*ADC转换后把结果锁存在结果寄存器*/     \
 AdcRegs.ADCCTL1.bit.TEMPCONV= 0;               \
 AdcRegs.ADCCTL1.bit.VREFLOCONV = 0;                                                         \
                                                                                                \
                        \
 /*AdcRegs.ADCCTL2.bit.CLKDIV2EN = 1; ADC时钟分频 */          \
 while(delay_cout >1) { delay_cout–; }   /*延时1MS*/                   \
                        \
 AdcRegs.SOCPRICTL.bit.RRPOINTER = 1;  /*循环指针返回指向SOC1*/       \
                        \

Eric Ma:

liangheng,

请问你测的1.4V是否直接在芯片的ADC输入引脚测出来的。

建议是先确保ADC引脚有确切的电平,然后再查看对应的结果寄存器,这样子排除硬件本身的问题。

Eric

大家好

         我最近在用28035进行ADC测试,使用官方F2803XILEG_VDC.H 头文件的ADC_MACRO_INIT宏,进行了一些修改如下,用定时器触发ADC转换,使用的是内部参考电压,但现在调试结果是输入低于1.4V电压没有采样值,高于1.4V才开始有采样值(从0开始)例如:输入1.8V,采样到1F5,换算后是0.4V(是把1.4当做起始值吗?),各位高手帮忙看看我的ADC初始化程序是不是错了,谢谢各位了。

 

#define ADC_MACRO_INIT(ChSel,Trigsel,ACQPS)              \
  asm(" RPT#100 || NOP");                                         \
                        \
    AdcRegs.ADCCTL1.all=ADC_RESET_FLAG;               \
 asm(" NOP ");                    \
 asm(" NOP ");                       \
                        \
 EALLOW;                      \
 AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; /* Power up band gap */        \
                        \
                                                                                  \
                            \
 AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; /*选择内部参考电压*/         \
    AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; /* Power up reference */       \
    AdcRegs.ADCCTL1.bit.ADCPWDN  = 1; /* Power up rest of ADC */       \
 AdcRegs.ADCCTL1.bit.ADCENABLE = 1; /* Enable ADC */         \
                        \
 asm(" RPT#100 || NOP");                                             \
                                                                                                \
 AdcRegs.ADCCTL1.bit.INTPULSEPOS= 1;  /*ADC转换后把结果锁存在结果寄存器*/     \
 AdcRegs.ADCCTL1.bit.TEMPCONV= 0;               \
 AdcRegs.ADCCTL1.bit.VREFLOCONV = 0;                                                         \
                                                                                                \
                        \
 /*AdcRegs.ADCCTL2.bit.CLKDIV2EN = 1; ADC时钟分频 */          \
 while(delay_cout >1) { delay_cout–; }   /*延时1MS*/                   \
                        \
 AdcRegs.SOCPRICTL.bit.RRPOINTER = 1;  /*循环指针返回指向SOC1*/       \
                        \

liangheng feng:

回复 Eric Ma:

Eric

          你好,谢谢你的答复。

          我是直接用电源给ADC输入引脚输入指定值的,输入时我用万用表测MCU的ADC引脚电压值是一致的。

         但是低于一定值的电压(例如1.4V)查看CCS的ADC结果寄存器没有数值显示,大于一定电压值才有采样值,但这个采样值不准确。

         我刚用了TI228035的ADC例子程序来调试那个电压值又要高于2.4V才有采样值,不知道这个是什么原因?求解答,是不是采样频率问题?还是初始化的问题(不知ADC初始化重点是哪部分,我对延时不是很了解,重置ADC要2个空操作吗?配置完到采样要有1MS延时吗?),问题有点多,请能帮我解答一下,谢谢。

       liangheng

大家好

         我最近在用28035进行ADC测试,使用官方F2803XILEG_VDC.H 头文件的ADC_MACRO_INIT宏,进行了一些修改如下,用定时器触发ADC转换,使用的是内部参考电压,但现在调试结果是输入低于1.4V电压没有采样值,高于1.4V才开始有采样值(从0开始)例如:输入1.8V,采样到1F5,换算后是0.4V(是把1.4当做起始值吗?),各位高手帮忙看看我的ADC初始化程序是不是错了,谢谢各位了。

 

#define ADC_MACRO_INIT(ChSel,Trigsel,ACQPS)              \
  asm(" RPT#100 || NOP");                                         \
                        \
    AdcRegs.ADCCTL1.all=ADC_RESET_FLAG;               \
 asm(" NOP ");                    \
 asm(" NOP ");                       \
                        \
 EALLOW;                      \
 AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; /* Power up band gap */        \
                        \
                                                                                  \
                            \
 AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; /*选择内部参考电压*/         \
    AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; /* Power up reference */       \
    AdcRegs.ADCCTL1.bit.ADCPWDN  = 1; /* Power up rest of ADC */       \
 AdcRegs.ADCCTL1.bit.ADCENABLE = 1; /* Enable ADC */         \
                        \
 asm(" RPT#100 || NOP");                                             \
                                                                                                \
 AdcRegs.ADCCTL1.bit.INTPULSEPOS= 1;  /*ADC转换后把结果锁存在结果寄存器*/     \
 AdcRegs.ADCCTL1.bit.TEMPCONV= 0;               \
 AdcRegs.ADCCTL1.bit.VREFLOCONV = 0;                                                         \
                                                                                                \
                        \
 /*AdcRegs.ADCCTL2.bit.CLKDIV2EN = 1; ADC时钟分频 */          \
 while(delay_cout >1) { delay_cout–; }   /*延时1MS*/                   \
                        \
 AdcRegs.SOCPRICTL.bit.RRPOINTER = 1;  /*循环指针返回指向SOC1*/       \
                        \

Eric Ma:

回复 liangheng feng:

liangheng,

 先建议你使用controlSUITE中关于ADC的例程

C:\ti\controlSUITE\device_support\f2803x\v127\DSP2803x_examples_ccsv5\adc_soc

先定位一下问题在软件还是在硬件,如果这个例程还存在上述问题,你就把原理图贴上来一起讨论。

Eric

大家好

         我最近在用28035进行ADC测试,使用官方F2803XILEG_VDC.H 头文件的ADC_MACRO_INIT宏,进行了一些修改如下,用定时器触发ADC转换,使用的是内部参考电压,但现在调试结果是输入低于1.4V电压没有采样值,高于1.4V才开始有采样值(从0开始)例如:输入1.8V,采样到1F5,换算后是0.4V(是把1.4当做起始值吗?),各位高手帮忙看看我的ADC初始化程序是不是错了,谢谢各位了。

 

#define ADC_MACRO_INIT(ChSel,Trigsel,ACQPS)              \
  asm(" RPT#100 || NOP");                                         \
                        \
    AdcRegs.ADCCTL1.all=ADC_RESET_FLAG;               \
 asm(" NOP ");                    \
 asm(" NOP ");                       \
                        \
 EALLOW;                      \
 AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; /* Power up band gap */        \
                        \
                                                                                  \
                            \
 AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; /*选择内部参考电压*/         \
    AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; /* Power up reference */       \
    AdcRegs.ADCCTL1.bit.ADCPWDN  = 1; /* Power up rest of ADC */       \
 AdcRegs.ADCCTL1.bit.ADCENABLE = 1; /* Enable ADC */         \
                        \
 asm(" RPT#100 || NOP");                                             \
                                                                                                \
 AdcRegs.ADCCTL1.bit.INTPULSEPOS= 1;  /*ADC转换后把结果锁存在结果寄存器*/     \
 AdcRegs.ADCCTL1.bit.TEMPCONV= 0;               \
 AdcRegs.ADCCTL1.bit.VREFLOCONV = 0;                                                         \
                                                                                                \
                        \
 /*AdcRegs.ADCCTL2.bit.CLKDIV2EN = 1; ADC时钟分频 */          \
 while(delay_cout >1) { delay_cout–; }   /*延时1MS*/                   \
                        \
 AdcRegs.SOCPRICTL.bit.RRPOINTER = 1;  /*循环指针返回指向SOC1*/       \
                        \

liangheng feng:

回复 Eric Ma:

Eric

       你好。我用controlSUITE的例程测试是2.3V以上才有采样值,但是用我自己写的定时器触发ADC的程序测试是1.6V以上才有采样值(还有我发现改变定时器的频率那个1.6V的边界有点变化,不知是不是跟ADC的触发频率有关。若有关,关系又是怎么的呢)。这样应该是软件问题吧,但我又不清楚问题在哪?请指点一下,谢谢了。

大家好

         我最近在用28035进行ADC测试,使用官方F2803XILEG_VDC.H 头文件的ADC_MACRO_INIT宏,进行了一些修改如下,用定时器触发ADC转换,使用的是内部参考电压,但现在调试结果是输入低于1.4V电压没有采样值,高于1.4V才开始有采样值(从0开始)例如:输入1.8V,采样到1F5,换算后是0.4V(是把1.4当做起始值吗?),各位高手帮忙看看我的ADC初始化程序是不是错了,谢谢各位了。

 

#define ADC_MACRO_INIT(ChSel,Trigsel,ACQPS)              \
  asm(" RPT#100 || NOP");                                         \
                        \
    AdcRegs.ADCCTL1.all=ADC_RESET_FLAG;               \
 asm(" NOP ");                    \
 asm(" NOP ");                       \
                        \
 EALLOW;                      \
 AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; /* Power up band gap */        \
                        \
                                                                                  \
                            \
 AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; /*选择内部参考电压*/         \
    AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; /* Power up reference */       \
    AdcRegs.ADCCTL1.bit.ADCPWDN  = 1; /* Power up rest of ADC */       \
 AdcRegs.ADCCTL1.bit.ADCENABLE = 1; /* Enable ADC */         \
                        \
 asm(" RPT#100 || NOP");                                             \
                                                                                                \
 AdcRegs.ADCCTL1.bit.INTPULSEPOS= 1;  /*ADC转换后把结果锁存在结果寄存器*/     \
 AdcRegs.ADCCTL1.bit.TEMPCONV= 0;               \
 AdcRegs.ADCCTL1.bit.VREFLOCONV = 0;                                                         \
                                                                                                \
                        \
 /*AdcRegs.ADCCTL2.bit.CLKDIV2EN = 1; ADC时钟分频 */          \
 while(delay_cout >1) { delay_cout–; }   /*延时1MS*/                   \
                        \
 AdcRegs.SOCPRICTL.bit.RRPOINTER = 1;  /*循环指针返回指向SOC1*/       \
                        \

liangheng feng:

回复 Eric Ma:

Eric

再补发原理图,求大牛帮我看看了。

大家好

         我最近在用28035进行ADC测试,使用官方F2803XILEG_VDC.H 头文件的ADC_MACRO_INIT宏,进行了一些修改如下,用定时器触发ADC转换,使用的是内部参考电压,但现在调试结果是输入低于1.4V电压没有采样值,高于1.4V才开始有采样值(从0开始)例如:输入1.8V,采样到1F5,换算后是0.4V(是把1.4当做起始值吗?),各位高手帮忙看看我的ADC初始化程序是不是错了,谢谢各位了。

 

#define ADC_MACRO_INIT(ChSel,Trigsel,ACQPS)              \
  asm(" RPT#100 || NOP");                                         \
                        \
    AdcRegs.ADCCTL1.all=ADC_RESET_FLAG;               \
 asm(" NOP ");                    \
 asm(" NOP ");                       \
                        \
 EALLOW;                      \
 AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; /* Power up band gap */        \
                        \
                                                                                  \
                            \
 AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; /*选择内部参考电压*/         \
    AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; /* Power up reference */       \
    AdcRegs.ADCCTL1.bit.ADCPWDN  = 1; /* Power up rest of ADC */       \
 AdcRegs.ADCCTL1.bit.ADCENABLE = 1; /* Enable ADC */         \
                        \
 asm(" RPT#100 || NOP");                                             \
                                                                                                \
 AdcRegs.ADCCTL1.bit.INTPULSEPOS= 1;  /*ADC转换后把结果锁存在结果寄存器*/     \
 AdcRegs.ADCCTL1.bit.TEMPCONV= 0;               \
 AdcRegs.ADCCTL1.bit.VREFLOCONV = 0;                                                         \
                                                                                                \
                        \
 /*AdcRegs.ADCCTL2.bit.CLKDIV2EN = 1; ADC时钟分频 */          \
 while(delay_cout >1) { delay_cout–; }   /*延时1MS*/                   \
                        \
 AdcRegs.SOCPRICTL.bit.RRPOINTER = 1;  /*循环指针返回指向SOC1*/       \
                        \

liangheng feng:

回复 Eric Ma:

Eric

      谢谢你真诚的解答。

      之前的问题解决了,是硬件问题。但现在又有一个问题:没跑程序时上电测试ADC引脚电压正常,但仿真跑程序的时候每个ADC引脚都悬空却有1.1V的电压,给引脚加一个电压测试ADC采样值是正确的,请问这是软件配置问题吗?

     衷心感谢你的回答。

大家好

         我最近在用28035进行ADC测试,使用官方F2803XILEG_VDC.H 头文件的ADC_MACRO_INIT宏,进行了一些修改如下,用定时器触发ADC转换,使用的是内部参考电压,但现在调试结果是输入低于1.4V电压没有采样值,高于1.4V才开始有采样值(从0开始)例如:输入1.8V,采样到1F5,换算后是0.4V(是把1.4当做起始值吗?),各位高手帮忙看看我的ADC初始化程序是不是错了,谢谢各位了。

 

#define ADC_MACRO_INIT(ChSel,Trigsel,ACQPS)              \
  asm(" RPT#100 || NOP");                                         \
                        \
    AdcRegs.ADCCTL1.all=ADC_RESET_FLAG;               \
 asm(" NOP ");                    \
 asm(" NOP ");                       \
                        \
 EALLOW;                      \
 AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; /* Power up band gap */        \
                        \
                                                                                  \
                            \
 AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; /*选择内部参考电压*/         \
    AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; /* Power up reference */       \
    AdcRegs.ADCCTL1.bit.ADCPWDN  = 1; /* Power up rest of ADC */       \
 AdcRegs.ADCCTL1.bit.ADCENABLE = 1; /* Enable ADC */         \
                        \
 asm(" RPT#100 || NOP");                                             \
                                                                                                \
 AdcRegs.ADCCTL1.bit.INTPULSEPOS= 1;  /*ADC转换后把结果锁存在结果寄存器*/     \
 AdcRegs.ADCCTL1.bit.TEMPCONV= 0;               \
 AdcRegs.ADCCTL1.bit.VREFLOCONV = 0;                                                         \
                                                                                                \
                        \
 /*AdcRegs.ADCCTL2.bit.CLKDIV2EN = 1; ADC时钟分频 */          \
 while(delay_cout >1) { delay_cout–; }   /*延时1MS*/                   \
                        \
 AdcRegs.SOCPRICTL.bit.RRPOINTER = 1;  /*循环指针返回指向SOC1*/       \
                        \

liangheng feng:

回复 Eric Ma:

Eric

       你好,感谢你百忙之中抽空回答我的问题,我还有一点疑问:为什么我没跑程序测时ADC引脚没电压,跑了程序测就有1点多伏的电压?1V的浮动电压是不是有点高,对ADC采样值会不会有影响?

       再次衷心感谢你。

liangfeng

大家好

         我最近在用28035进行ADC测试,使用官方F2803XILEG_VDC.H 头文件的ADC_MACRO_INIT宏,进行了一些修改如下,用定时器触发ADC转换,使用的是内部参考电压,但现在调试结果是输入低于1.4V电压没有采样值,高于1.4V才开始有采样值(从0开始)例如:输入1.8V,采样到1F5,换算后是0.4V(是把1.4当做起始值吗?),各位高手帮忙看看我的ADC初始化程序是不是错了,谢谢各位了。

 

#define ADC_MACRO_INIT(ChSel,Trigsel,ACQPS)              \
  asm(" RPT#100 || NOP");                                         \
                        \
    AdcRegs.ADCCTL1.all=ADC_RESET_FLAG;               \
 asm(" NOP ");                    \
 asm(" NOP ");                       \
                        \
 EALLOW;                      \
 AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; /* Power up band gap */        \
                        \
                                                                                  \
                            \
 AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; /*选择内部参考电压*/         \
    AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; /* Power up reference */       \
    AdcRegs.ADCCTL1.bit.ADCPWDN  = 1; /* Power up rest of ADC */       \
 AdcRegs.ADCCTL1.bit.ADCENABLE = 1; /* Enable ADC */         \
                        \
 asm(" RPT#100 || NOP");                                             \
                                                                                                \
 AdcRegs.ADCCTL1.bit.INTPULSEPOS= 1;  /*ADC转换后把结果锁存在结果寄存器*/     \
 AdcRegs.ADCCTL1.bit.TEMPCONV= 0;               \
 AdcRegs.ADCCTL1.bit.VREFLOCONV = 0;                                                         \
                                                                                                \
                        \
 /*AdcRegs.ADCCTL2.bit.CLKDIV2EN = 1; ADC时钟分频 */          \
 while(delay_cout >1) { delay_cout–; }   /*延时1MS*/                   \
                        \
 AdcRegs.SOCPRICTL.bit.RRPOINTER = 1;  /*循环指针返回指向SOC1*/       \
                        \

Tony Chopper:

回复 Eric Ma:

您好 请问 28335的ADC内部参考电压是0.75V 为什么模拟量输入最大是3V???

赞(0)
未经允许不得转载:TI中文支持网 » DSP28035的ADC转换
分享到: 更多 (0)