Page 1 of 1

Pic16f18446 with MCP9800, couldn't change resolution

PostPosted: Mon Sep 29, 2025 10:52 am
by mick
By using the function I2C2_Write(uint16_t address, uint8_t* data, size_t dataLength)

Below is my coding ;

MCP9800_Write[0] = 0x01;
MCP9800_Write[1] = 0x60;
writelength = 2;

I2C2_Write(MCP9800_I2C_Addr,MCP9800_Write,writelength);

the output is
MCP9800 Temp = 96.004 Dec.C
(the correct output is 31.0625 Dec. C)

Re: Pic16f18446 with MCP9800, couldn't change resolution

PostPosted: Tue May 12, 2026 3:46 am
by AussieSusan
You will need to provide us with a lot more information.
For example, what is the I2C2_Write function? My guess it is some library function but from where?
Looking at the data sheet for the MCP9800, my guess is that the code snippet you have provided is trying to write to the sensor configuration register (internal register address 0x01) to set the resolution to 12 bit. However I can't see how that relates to output that you say you are getting.
Please show us the complete source code (or at least a complete app that demonstrates the problem) including the CONFIG bits.
Susan