Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Tcn75a i2c

Status
Not open for further replies.
// Setup Config reg for 12bit A/D conversion
SWStartI2C(); // Start
SWPutcI2C(0x90); // Address byte (write)
SWAckI2C();
SWPutcI2C(0x01); // Pointer (config)
SWAckI2C();
SWPutcI2C(0x60); // Data (12bit A/D conversion)
SWAckI2C();
SWStopI2C(); // Stop

// Set pointer to temperature reg
SWStartI2C(); // Start
SWPutcI2C(0x90); // Address byte (write)
SWAckI2C();
SWPutcI2C(0x00); // Pointer (temp)
SWAckI2C();
SWStopI2C(); // Stop

Why do you set the pointer here! Do you not set the pointer when you read.. From the datasheet it looks like you MUST set the pointer each read.
 
No I don't. As I said, the code does work. But I only get a 9 bit reading unless I run the init routine twice. Then I get the desired 12 bit reading.
 
Yes, that's a good point. The circuit is currently constructed on breadboard with long lengths of kynar wire attached to the TCN75A (it's an 8 pin MSOP).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top