• AVR Freaks

MCP9600 problem

Author
carlo dalla val
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2014/11/27 07:09:28
  • Location: 0
  • Status: offline
2020/07/19 06:24:05 (permalink)
0

MCP9600 problem

Hi all,
I need a support in using MCP9600 thermocouple device.
I have tried to follow the example into the datasheet but it doesn't seem to work. 
Actually when I read the upper byte and the lower byte of the Th I receive 255 on both, regardless of the temperature.
Here below my very simple test code...hope someone is able to help me. 
 
void temp_init (void)
{
MSSP_I2C_Start();
MSSP_I2C_Write(0x66);
MSSP_I2C_Write(0b00000101);//write on this register the rest should be ok
MSSP_I2C_Write(0b00000000);//set thermocouple to  K no filter
MSSP_I2C_Stop();
}
void temp_read(void)
{
I2C_SLAVE= 0x66;
MSSP_I2C_Start();
MSSP_I2C_Write(0x66); //write operation
MSSP_I2C_Write(0b00000000); //select operation on Th register
MSSP_I2C_Stop();
__delay_ms(1); //stretch time
MSSP_I2C_Start();
MSSP_I2C_Write(0x67); //read
datah = MSSP_I2C_Read(1);
datal = MSSP_I2C_Read(0);
MSSP_I2C_Stop();
temperature = (datah*16) + (datal/16); //temperature is always > than 0 
}
 
Both datah and datal are 255...I'm sure I am missing something....
Thanks a lot 
 
#1

1 Reply Related Threads

    carlo dalla val
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2014/11/27 07:09:28
    • Location: 0
    • Status: offline
    Re: MCP9600 problem 2020/07/19 06:45:36 (permalink)
    4 (1)
    Hello all,
    sorry...I did a big mistake of reading the datasheet...it was a simple address problem. 
    It is now working fine. I apologise for disturbing the forum.
    Thanks
     
    #2
    Jump to:
    © 2020 APG vNext Commercial Version 4.5