刚学习MSP430芯片,之前用ADC12的可以,想换ADC10变化小点,把寄存器改了,怎么都报错
头加载如下
#include "msp430x54x.h"
#include <stdio.h>
#include <stdint.h>
// 只有在ADC12ENC复位的情况下才可以操作
// ADC12SHT1X ADC12SHT0X ADC12MSC ADC12REF2_5V ADC12REFON ADC12ON
ADC10CTL0 &= ~ADC10ENC;
// 设置采样保持时间,最大时间周期以提高转换精度
// 注意MSP430F5438没有REF模块,片内基准无效
// 操作ADC12REF2_5V ,ADC12REFON并无意义
ADC10CTL0 = ADC10SHT0_15 + ADC10SHT1_15 + ADC10ON + ADC10MSC;
// ADC12CTL0 = ADC12SHT0_15 + ADC12SHT1_15 + ADC12ON +
// ADC12REF2_5V + ADC12REFON;
// 采样保持脉冲来自采样定时器
ADC10CTL1 = ADC10SHP + ADC10CONSEQ_2;
// 关闭内部内部温度检测以降低功耗,注意或操作否则修改转换精度
ADC10CTL2 |= ADC10TCOFF ;
// 基准电压选择AVCC,并选择11通道——(AVCC-AVSS)/2
// ADC12MCTL0 = ADC12SREF_0 + ADC12INCH_11;
ADC10MCTL0 = ADC10SREF_0 + ADC10INCH_4;
__delay_cycles(75);
// ADC12使能
ADC10CTL0 |= ADC10ENC;
ADC10CTL0 |= ADC10SC; // 启动转换
main.c
Error[Pe020]: identifier "ADC10IFG" is undefined E:proMSP4305437-PRO2-adc10main.c 79
Error[Pe020]: identifier "ADC10MEM0" is undefined E:proMSP4305437-PRO2-adc10main.c 89
Error[Pe020]: identifier "ADC10CTL0" is undefined E:proMSP4305437-PRO2-adc10main.c 207
Error[Pe020]: identifier "ADC10ENC" is undefined E:proMSP4305437-PRO2-adc10main.c 207
Error[Pe020]: identifier "ADC10SHT0_15" is undefined E:proMSP4305437-PRO2-adc10main.c 212
Error[Pe020]: identifier "ADC10SHT1_15" is undefined E:proMSP4305437-PRO2-adc10main.c 212
Error[Pe020]: identifier "ADC10ON" is undefined E:proMSP4305437-PRO2-adc10main.c 212
Error[Pe020]: identifier "ADC10MSC" is undefined E:proMSP4305437-PRO2-adc10main.c 212
Error[Pe020]: identifier "ADC10CTL1" is undefined E:proMSP4305437-PRO2-adc10main.c 216
Error[Pe020]: identifier "ADC10SHP" is undefined E:proMSP4305437-PRO2-adc10main.c 216
Error[Pe020]: identifier "ADC10CONSEQ_2" is undefined E:proMSP4305437-PRO2-adc10main.c 216
Error[Pe020]: identifier "ADC10CTL2" is undefined E:proMSP4305437-PRO2-adc10main.c 220
Error[Pe020]: identifier "ADC10TCOFF" is undefined E:proMSP4305437-PRO2-adc10main.c 220
Error[Pe020]: identifier "ADC10MCTL0" is undefined E:proMSP4305437-PRO2-adc10main.c 223
Error[Pe020]: identifier "ADC10SREF_0" is undefined E:proMSP4305437-PRO2-adc10main.c 223
Error[Pe020]: identifier "ADC10INCH_4" is undefined E:proMSP4305437-PRO2-adc10main.c 223
Error[Pe020]: identifier "ADC10SC" is undefined E:proMSP4305437-PRO2-adc10main.c 228
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
如果不想要那么高的精度,可以舍去一部分
一周热门 更多>