Pic16f18446 with MCP9800, couldn't change resolution

Pic16f18446 with MCP9800, couldn't change resolution

Postby mick » Mon Sep 29, 2025 10:52 am

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)
mick
 
Posts: 1
Joined: Sun Sep 28, 2025 4:02 pm

Re: Pic16f18446 with MCP9800, couldn't change resolution

Postby AussieSusan » Tue May 12, 2026 3:46 am

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
AussieSusan
Verified identity
 
Posts: 185
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist


Return to SSP (IIC, SPI)

Who is online

Users browsing this forum: No registered users and 84 guests