This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5437里有ADC10这个硬件资源吗?

Other Parts Discussed in Thread: MSP430F5437, MSP430F5438, MSP430F5437A

我最近刚用MSP430F5437  用的IAR  ,c语言编程;

头文件加载

#include "msp430x54x.h"

void adc10_config(void)
{
// 只有在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; // 启动转换

}

之前用的ADC12可以,直接把 寄存器改成ADC10   不知道为什么报错:

Error[Pe020]: identifier "ADC10MEM0" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 89
Error[Pe020]: identifier "ADC10CTL0" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 207
Error[Pe020]: identifier "ADC10ENC" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 207
Error[Pe020]: identifier "ADC10SHT0_15" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 212
Error[Pe020]: identifier "ADC10SHT1_15" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 212
Error[Pe020]: identifier "ADC10ON" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 212
Error[Pe020]: identifier "ADC10MSC" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 212
Error[Pe020]: identifier "ADC10CTL1" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 216
Error[Pe020]: identifier "ADC10SHP" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 216
Error[Pe020]: identifier "ADC10CONSEQ_2" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 216
Error[Pe020]: identifier "ADC10CTL2" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 218
Error[Pe020]: identifier "ADC10TCOFF" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 218
Error[Pe020]: identifier "ADC10MCTL0" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 221
Error[Pe020]: identifier "ADC10SREF_0" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 221
Error[Pe020]: identifier "ADC10INCH_4" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 221
Error[Pe020]: identifier "ADC10SC" is undefined E:\pro\MSP430\5437-PRO2-adc10\main.c 226
Error while running C/C++ compiler

头文件里没有对应ADC10寄存器是为什么,好奇怪,手册里有ADC10啊?

  • 楼主,

      你可以具体查看我们的数据手册:

    http://www.ti.com/lit/ds/symlink/msp430f5437a.pdf,

    它是支持12位ADC的。

    谢谢

  • 那我用12位时,

    好像可以选择8位 0~255,10 位0~1023,12位  0~4096的吧?

    为什么我这样设置了:ADC12CTL2  = ADC12TCOFF +  ADC12RES_0;

    ADC12MEM0 还是0~4095呢?谢谢

    没有效果呢?

    5-4 ADC12RES RW 2h ADC12_A resolution. This bit defines the conversion result resolution.
    00b = 8 bit (9 clock cycle conversion time)
    01b = 10 bit (11 clock cycle conversion time)
    10b = 12 bit (13 clock cycle conversion time)
    11b = Reserved
    3 ADC12DF RW 0h ADC12_A data read-back format. Data is always stored in the binary unsigned
    format.
    0b = Binary unsigned. Theoretically, the analog input voltage -VREF results in
    0000h, the analog input voltage +VREF results in 0FFFh.
    1b = Signed binary (2s complement), left aligned. Theoretically, the analog input
    voltage -VREF results in 8000h, the analog input voltage +VREF results in
    7FF0h.

  • Ken Wang 说:

    楼主,

      你可以具体查看我们的数据手册:

    http://www.ti.com/lit/ds/symlink/msp430f5437a.pdf,

    它是支持12位ADC的。

    谢谢

    F5437A and F5437 (none A) are not interchangeable.