1

DS1621 (arduino) について質問があります。

HIGH で摂氏 25 度を超える温度を示すために、ピン 3 (TOut) に送信する必要があるコマンドとパラメーターは何ですか?

Wire lib を使用したい。これは正しいですか、それとも他に何が必要ですか?

 #define DEV_ID 0x90 >> 1 
 int tempC = 25;  //for 25 Celsius 

 void setup() {
  Serial.begin(9600);           
  Wire.begin();
  Wire.beginTransmission(DEV_ID);           // connect to DS1621 
  Wire.send(0xAC);                          
  Wire.send(0x02);                          
  Wire.beginTransmission(DEV_ID);           
  Wire.send(0xEE);                          
  Wire.endTransmission();
 }

 void loop() {
  tempC = Wire.receive();
  Serial.print(tempC);
 }
4

1 に答える 1

0

Tout は「サーモスタット出力。温度が TH を超えるとアクティブになり、温度が TL を下回るとリセットされます。」

したがって、TL と TH を設定する必要があります。値を送信するには、制御バイトを送信する必要があります

[A1h] [TH の値] [A2h] [TL の値]

幸いなことに、25 度は 0x19 または 00011001 として与えられた値であるため、私のコードは次のようになります

 Wire.begin();
 Wire.beginTransmission(DEV_ID);           //I am talking to you
 Wire.send(0xA1);                          //I want to change TH
 Wire.send(0x19);                          //Value of 25
 Wire.endTransmission();

 Wire.beginTransmission(DEV_ID);           //I am talking to you
 wire.send(0xA2);                          //I want to change TL
 Wire.send(0x19);                          //value of 25                      
 Wire.endTransmission();

残りのコードを追加/保持しましたが、それでうまくいくかどうかを確認してください。

データシートはこちらhttp://pdfserv.maximintegrated.com/en/ds/DS1621.pdf

于 2013-06-04T12:26:31.153 に答える