I am looking help to understand source code from here [url=https://github.com/DcubeTechVentures/TCN75A/blob/master/Arduino/TCN75A.ino]https://github.com/DcubeTechVentures/TCN75A/blob/master/Arduino/TCN75A.ino[/url]
Datasheet [url=http://ww1.microchip.com/downloads/en/DeviceDoc/21490D.pdf]http://ww1.microchip.com/downloads/en/DeviceDoc/21490D.pdf[/url]
I do not understand following parts of source code
[code
// Start I2C transmission
Wire.beginTransmission(Addr);
// Select configuration register
Wire.write(0x01);
// 12-bit ADC resolution
Wire.write(0x60);
// Stop I2C transmission
Wire.endTransmission();
delay(300);
}
void loop()
{
unsigned int data[2];
// Start I2C transmission
Wire.beginTransmission(Addr);
// Select data register
Wire.write(0x00);
// Stop I2C transmission
Wire.endTransmission();
// Request 2 bytes of data
Wire.requestFrom(Addr, 2);
// Read 2 bytes of data
// temp msb, temp lsb
if (Wire.available() == 2)
{
data[0] = Wire.read();
data[1] = Wire.read();
}
}
Start then Send slave address then send address of configuration register (0x01)then write data 0x60 to configuration register then stop
Start then Send slave address then send Select data register stop
any help would be appreciate
gfvalvo:
What is your question?
I am looking help to understand source code from here
Datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/21490D.pdf
I do not understand following parts of source code
// Start I2C transmission
Wire.beginTransmission(Addr);
// Select configuration register
Wire.write(0x01);
// 12-bit ADC resolution
Wire.write(0x60);
// Stop I2C transmission
Wire.endTransmission();
delay(300);
}
void loop()
{
unsigned int data[2];
// Start I2C transmission
Wire.beginTransmission(Addr);
// Select data register
Wire.write(0x00);
// Stop I2C transmission
Wire.endTransmission();
// Request 2 bytes of data
Wire.requestFrom(Addr, 2);
// Read 2 bytes of data
// temp msb, temp lsb
if (Wire.available() == 2)
{
data[0] = Wire.read();
data[1] = Wire.read();
}
}
I do not understand following parts of source code
Each line has a comment that explains it, which ones do you not understand and what is your best guess at what they mean?