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.

温度传感器TMP122读时序问题

Other Parts Discussed in Thread: TMP122

我写的TMP122的读温度时序感觉有问题,单片机总是读不到值······

#include"msp430x14x.h"

#include"simple.h"

int main(void)

{

  uint i,temp=0,temph=0,templ=0;

  init();

  while(1)

  {

   _NOP();

   CS_L;

  for(i=0;i<8;i++)

  {

    SCK_H;

    _NOP();

    temph<<=1;

    if(SOI_IN&BIT0)

    {

      temph+=0X01;

    }

    //temph<<=1;

    SCK_L;

  }

  for(i=0;i<8;i++)

  {

    SCK_H;

    templ<<=1;

    _NOP();

    if(SOI_IN&BIT0)

    {

     templ+=0X01;

    }

   SCK_L;

  }

  CS_H;

  temp=(uint)temph;

  temp<<=8;

  temp+=(uint)(templ&0XF8);

  temp>>=7;

  show_1602(temp);

  }

}