按理说模拟输入口应该测量0V的电压,但即使是接了个10K的电阻到地,也量到200mV的电压。
拆腾了两天,没有结果。附初始化程序:
EALLOW;
GpioCtrlRegs.AIOMUX1.bit.AIO2 = 2; // Configure AIO2 for A2 (analog input) operation
GpioCtrlRegs.AIOMUX1.bit.AIO4 = 2; // Configure AIO4 for A4 (analog input) operation
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // Enable Clock to the ADC
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Comparator shares the internal BG reference of the ADC, must be powered even if ADC is unused
SysCtrlRegs.PCLKCR3.bit.COMP1ENCLK = 1; // Enable clock to the Comparator 1 block SysCtrlRegs.PCLKCR3.bit.COMP2ENCLK = 1; // Enable clock to the Comparator 2 block
Comp1Regs.COMPCTL.bit.COMPDACEN = 1; //Enable the comparator block
Comp1Regs.COMPCTL.bit.CMPINV = 0; //Inverted output of comparator is passed
Comp1Regs.COMPCTL.bit.COMPSOURCE= 0; //Source select for comparator inverting input:0-internal ADC;1-external pin
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Synchronization select for outputofthe comparator before being passed to ETPWM/GPIO blocks:0-Asynchronous;1-Synchronous
Comp1Regs.COMPCTL.bit.QUALSEL = 14;
Comp1Regs.DACVAL.all= 1000;
EDIS;
10#:
将该引脚上的所有外部线路移除后测试看看?
另外,A4/A6/B2/B4/B6这些引脚呢?
按理说模拟输入口应该测量0V的电压,但即使是接了个10K的电阻到地,也量到200mV的电压。
拆腾了两天,没有结果。附初始化程序:
EALLOW;
GpioCtrlRegs.AIOMUX1.bit.AIO2 = 2; // Configure AIO2 for A2 (analog input) operation
GpioCtrlRegs.AIOMUX1.bit.AIO4 = 2; // Configure AIO4 for A4 (analog input) operation
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // Enable Clock to the ADC
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Comparator shares the internal BG reference of the ADC, must be powered even if ADC is unused
SysCtrlRegs.PCLKCR3.bit.COMP1ENCLK = 1; // Enable clock to the Comparator 1 block SysCtrlRegs.PCLKCR3.bit.COMP2ENCLK = 1; // Enable clock to the Comparator 2 block
Comp1Regs.COMPCTL.bit.COMPDACEN = 1; //Enable the comparator block
Comp1Regs.COMPCTL.bit.CMPINV = 0; //Inverted output of comparator is passed
Comp1Regs.COMPCTL.bit.COMPSOURCE= 0; //Source select for comparator inverting input:0-internal ADC;1-external pin
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Synchronization select for outputofthe comparator before being passed to ETPWM/GPIO blocks:0-Asynchronous;1-Synchronous
Comp1Regs.COMPCTL.bit.QUALSEL = 14;
Comp1Regs.DACVAL.all= 1000;
EDIS;
aaaa noname:
回复 10#:
悬空测试过,量到是3V,供电是3.3V
按理说模拟输入口应该测量0V的电压,但即使是接了个10K的电阻到地,也量到200mV的电压。
拆腾了两天,没有结果。附初始化程序:
EALLOW;
GpioCtrlRegs.AIOMUX1.bit.AIO2 = 2; // Configure AIO2 for A2 (analog input) operation
GpioCtrlRegs.AIOMUX1.bit.AIO4 = 2; // Configure AIO4 for A4 (analog input) operation
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // Enable Clock to the ADC
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Comparator shares the internal BG reference of the ADC, must be powered even if ADC is unused
SysCtrlRegs.PCLKCR3.bit.COMP1ENCLK = 1; // Enable clock to the Comparator 1 block SysCtrlRegs.PCLKCR3.bit.COMP2ENCLK = 1; // Enable clock to the Comparator 2 block
Comp1Regs.COMPCTL.bit.COMPDACEN = 1; //Enable the comparator block
Comp1Regs.COMPCTL.bit.CMPINV = 0; //Inverted output of comparator is passed
Comp1Regs.COMPCTL.bit.COMPSOURCE= 0; //Source select for comparator inverting input:0-internal ADC;1-external pin
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Synchronization select for outputofthe comparator before being passed to ETPWM/GPIO blocks:0-Asynchronous;1-Synchronous
Comp1Regs.COMPCTL.bit.QUALSEL = 14;
Comp1Regs.DACVAL.all= 1000;
EDIS;
10#:
回复 aaaa noname:
1. 测量方法是否有问题?
2. 换个空片重试下?或者直接擦除程序看看?
3. 上面提到的其它引脚呢?
按理说模拟输入口应该测量0V的电压,但即使是接了个10K的电阻到地,也量到200mV的电压。
拆腾了两天,没有结果。附初始化程序:
EALLOW;
GpioCtrlRegs.AIOMUX1.bit.AIO2 = 2; // Configure AIO2 for A2 (analog input) operation
GpioCtrlRegs.AIOMUX1.bit.AIO4 = 2; // Configure AIO4 for A4 (analog input) operation
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // Enable Clock to the ADC
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Comparator shares the internal BG reference of the ADC, must be powered even if ADC is unused
SysCtrlRegs.PCLKCR3.bit.COMP1ENCLK = 1; // Enable clock to the Comparator 1 block SysCtrlRegs.PCLKCR3.bit.COMP2ENCLK = 1; // Enable clock to the Comparator 2 block
Comp1Regs.COMPCTL.bit.COMPDACEN = 1; //Enable the comparator block
Comp1Regs.COMPCTL.bit.CMPINV = 0; //Inverted output of comparator is passed
Comp1Regs.COMPCTL.bit.COMPSOURCE= 0; //Source select for comparator inverting input:0-internal ADC;1-external pin
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Synchronization select for outputofthe comparator before being passed to ETPWM/GPIO blocks:0-Asynchronous;1-Synchronous
Comp1Regs.COMPCTL.bit.QUALSEL = 14;
Comp1Regs.DACVAL.all= 1000;
EDIS;
aaaa noname:
回复 10#:
由于程序是从28035移植的,build选项没改,用了大内存模式,但链接了rts2800.lib。更改为rts2800ml.lib后,问题解决。
按理说模拟输入口应该测量0V的电压,但即使是接了个10K的电阻到地,也量到200mV的电压。
拆腾了两天,没有结果。附初始化程序:
EALLOW;
GpioCtrlRegs.AIOMUX1.bit.AIO2 = 2; // Configure AIO2 for A2 (analog input) operation
GpioCtrlRegs.AIOMUX1.bit.AIO4 = 2; // Configure AIO4 for A4 (analog input) operation
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // Enable Clock to the ADC
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Comparator shares the internal BG reference of the ADC, must be powered even if ADC is unused
SysCtrlRegs.PCLKCR3.bit.COMP1ENCLK = 1; // Enable clock to the Comparator 1 block SysCtrlRegs.PCLKCR3.bit.COMP2ENCLK = 1; // Enable clock to the Comparator 2 block
Comp1Regs.COMPCTL.bit.COMPDACEN = 1; //Enable the comparator block
Comp1Regs.COMPCTL.bit.CMPINV = 0; //Inverted output of comparator is passed
Comp1Regs.COMPCTL.bit.COMPSOURCE= 0; //Source select for comparator inverting input:0-internal ADC;1-external pin
Comp1Regs.COMPCTL.bit.SYNCSEL = 0; //Synchronization select for outputofthe comparator before being passed to ETPWM/GPIO blocks:0-Asynchronous;1-Synchronous
Comp1Regs.COMPCTL.bit.QUALSEL = 14;
Comp1Regs.DACVAL.all= 1000;
EDIS;
10#:
回复 aaaa noname:
Ok,所以说擦除程序是不存在此问题的,可能跟代码控制有关。
建议将此帖结了吧。