Re: [問題] 溫度感測器MAX6675的library
※ 引述《ken1325 (優質水瓶男)》之銘言:
: 我手上有一個溫度感測器MAX6675模組
: 然後我去下載這個library來用
: http://0rz.tw/C1Z1k
: 在 MAX6675.cpp 這個檔案裡
: 有一段是這樣寫
: /*
: Read bits 14-3 from MAX6675 for the Temp. Loop for each bit reading
: the value and storing the final value in 'temp'
: */
: for (int i=11; i>=0; i--) {
: digitalWrite(_SCK_pin,HIGH);
: value += digitalRead(_SO_pin) << i;
: digitalWrite(_SCK_pin,LOW);
: }
: 它說這段是讀取第14個~第3個bit
: 那為什麼 i 的值是從11~0,為什麼不是從14~3?
: 有點想不通
: thx
因為你少看了上面的項目
/* Read the chip and return the raw temperature value */
/*
Bring CS pin low to allow us to read the data from
the conversion process
*/
digitalWrite(_CS_pin,LOW);
/* Cycle the clock for dummy bit 15 */
digitalWrite(_SCK_pin,HIGH);
delay(1);
digitalWrite(_SCK_pin,LOW);
這個就先提出dummy bit了
接下來當然是14~3的提取
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.163.254.68
※ 文章網址: https://www.ptt.cc/bbs/ASM/M.1433510696.A.CE8.html
→
06/05 22:22, , 1F
06/05 22:22, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
ASM 近期熱門文章
PTT數位生活區 即時熱門文章