Re: [問題] 溫度感測器MAX6675的library

看板ASM作者時間9年前 (2015/06/05 21:24), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《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
文章代碼(AID): #1LSQCepe (ASM)
文章代碼(AID): #1LSQCepe (ASM)