打印

LAUNCHPAD 温度采集程序

[复制链接]
1350|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
wsdymg|  楼主 | 2013-4-21 11:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
airwill| | 2013-4-22 09:20 | 只看该作者
就是 ADC 采样芯片内部集成的温度传感器. 这一块两个芯片都是一样的

使用特权

评论回复
板凳
wsdymg|  楼主 | 2013-4-23 16:29 | 只看该作者
我看了一下程序好像有个函数不太一样,
其中一个是这样:
// Function Transmits Character from TXByte
void Transmit()
{
  BitCnt = 0xA;                             // Load Bit counter, 8data + ST/SP

  /* Simulate a timer capture event to obtain the value of TAR into the TACCR0 register */
  TACCTL0 = CM_1 + CCIS_2  + SCS + CAP + OUTMOD0;           //capture on rising edge, initially set to GND as input // clear CCIFG flag
  TACCTL0 |= CCIS_3;                                                 //change input to Vcc, effectively rising the edge, triggering the capture action

  while (!(TACCTL0 & CCIFG));                                //allowing for the capturing//updating TACCR0.

  TACCR0 += Bitime ;                           // Some time till first bit
  TXByte |= 0x100;                          // Add mark stop bit to TXByte
  TXByte = TXByte << 1;                     // Add space start bit
  TACCTL0 =  CCIS0 + OUTMOD0 + CCIE;          // TXD = mark = idle

  while ( TACCTL0 & CCIE );                   // Wait for TX completion
}
另外一个是这样:
void Transmit()
{
  BitCnt = 0xA;                             // 装载位计数器, 8data + ST/SP
  while (CCR0 != TAR)                       // 防止异步捕获
    CCR0 = TAR;                             // 当前TA计数器的状态
  CCR0 += Bitime;                           // 一些时间直到第一位
  TXByte |= 0x100;                          // 新增标记停止位TXByte
  TXByte = TXByte << 1;                     // 加空间的起始位
  CCTL0 =  CCIS0 + OUTMOD0 + CCIE;          // TXD = mark = idle
  while ( CCTL0 & CCIE );                   // 等待TX完成
}
不是太明白二者的区别,希望大哥大姐给分析一下!

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

25

主题

267

帖子

6

粉丝