Board logo

标题: 求助:关于MC68HC908SR12温度传感器和两阶放大器 [打印本页]

作者: emugine    时间: 2006-3-20 15:35     标题: 求助:关于MC68HC908SR12温度传感器和两阶放大器

在MC68HC908SR12 datasheet Page 384页 24.14.1里表24-12描述温度斜率为:
VDD=5V±10%,GAINA=2,GAINB=6 MIN 1.275 ADCsteps/度,Typ 1.338ADCsteps/度,Max 1.372ADCsteps/度
我的电源VDD=5V±10%,GAINA=2,GAINB=6,我在程序里的设置如下:


word  AD_word;
AMGCR=81;//GAINA=2,GAINB=6
AMSCR=34;//00100010
          //AMCDIV[1:0]=00 Analog Module Clock Divider Control Bits,
                   // Set AMCDIV1 and AMCDIV0 bits to
                   //zero for optimum analog module performance.
          //OPIFR =1 Amplifier Ready Interrupt Flag Reset,
                   //1 = Clear OPIF bit
          //OPIF=0 Amplifier Ready Interrupt Flag
                  // 1 = Two-stage amplifier output is ready
          //0
          //DOF=0  DC Offset Flag, This is a reserved bit.
          //CDIFR=1  Current Detect Interrupt Flag Reset,
                     //Writing a logic 1 to this write-only
                     //bit clears the CDIF bit.
          //CDIF=0 Current Detect Interrupt Flag,
                    //1 = Current detect interrupt has occurred
 AMCR=240;//11110000       Analog Module Control Register (AMCR)
  //PWR1 PWR0=1 1 CurrentDetectModule=On
                     //TemperatureSensor=On Two-StageAmplifier=On
  //OPCH1 OPCH0 1 1   Internal temperature sensor
 //AMIEN =0 Analog module CPU interrupt requests disabled
 //DO[2:0]=000 DC Offset Control Bits 
                 //Set these bits to zero for optimum analog module performance.


 while(!AMSCR_OPIF);//wait for Amplifier Ready
 ADICLK=0x54;//01010100
             //010 ADIV2 ADIV1 ADIV0 ADC INPUT CLOCK/4
             //1   ADICLK  select internal clock
             //01 MODE1 MODE0 Right justified mode
 ADSCR=0x00|13;//select OPOUT
 while(!ADSCR_COCO);
 AD_word= (ADR0H&0x03)*256+ ADR0L;


但我得到的AD转换的数据总是从690到720,什么数都有,不稳定,我觉得实际温度就是20几度,
应该如何得到正确的温度,各位牛人请帮我.万分感谢了。






欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0