Page 1 of 1

i2c problem with TC74

Posted: Thu Oct 04, 2012 6:33 pm
by juanlu
Hi,

I am doing course of Programming embeded PIC in chapter i2c.
It is needed to read temperature value of TC74 and then show the results in lcd wiht pic 18f4455.
I have tried the code of the course but not good results. lcd is showing always 255ÂșC. There is a error communication.

Pull resistors are ok 2k2 to SDA and SCL
Any idea to solve it? How can I check if component TC74 is OK?

Thanks,

Re: i2c problem with TC74

Posted: Mon Oct 08, 2012 4:10 pm
by Enamul
Hi,
I have found a blog for this IC..you can follow that see how far you can go with that..programming that IC using Flowcode shouldn't be very tough..let us know if you stuck at any point..
http://embedded-lab.com/blog/?p=3146

Re: i2c problem with TC74

Posted: Mon Oct 08, 2012 8:22 pm
by kersing
Attached a flowchart I created some years ago to read bytes from the memory of an I2C eeprom (24AA02E48). Hope this helps you on the way...

Re: i2c problem with TC74

Posted: Mon Oct 08, 2012 10:12 pm
by juanlu
Thanks for your help.

Here I attach flowchart.

LCD always shows 255. Address of tc74 0b1001000. ANy idea about if there is something wrong in software?

Re: i2c problem with TC74

Posted: Mon Oct 08, 2012 10:33 pm
by Enamul
Hi,
I have changed few things..let us know how it's behaving..

Re: i2c problem with TC74

Posted: Mon Oct 08, 2012 10:48 pm
by kersing
Looking at the flowchart I've noticed two things:
1) After the read you are transmitting a byte (1). Why?
2) You are not sending a I2C_Stop after the transaction has completed.

You might want to check if removing the transmit and adding a stop makes any difference.

Re: i2c problem with TC74

Posted: Mon Oct 08, 2012 10:57 pm
by kersing
Hi Enamul,

According to the message from juanlu the device ID is 0x48, why have you changed it to 0x4d in your code?

Regards,

Jac

Re: i2c problem with TC74

Posted: Mon Oct 08, 2012 10:58 pm
by kersing
juanlu wrote:Hi,
It is needed to read temperature value of TC74 and then show the results in lcd wiht pic 18f4455.
To which PIC pins is your TC74 connected?

Re: i2c problem with TC74

Posted: Mon Oct 08, 2012 11:05 pm
by Enamul
According to the message from juanlu the device ID is 0x48, why have you changed it to 0x4d in your code?
I was following datasheet..datasheet is saying so..
address.png
(6.74 KiB) Downloaded 6517 times
But the following also true and I might be wrong depending on his device..
The default 7-bit I2C address of TC74 is 1001 101b. However, 7 other address options are also available which can be identified from the part number of the device. For example, I have got a TC74A0 in TO-220 package. A0 corresponds to the device address 1001 000b. Similarly, TC74A3 has its I2C address 1001 011b.

Re: i2c problem with TC74

Posted: Tue Oct 09, 2012 8:45 pm
by juanlu
Kersin,

AS per my course documents in flowcode acknowledge and noacknowledge are included in the mi2c_send routine. Zero means datas was acknowledge and one means no reply. Return value will of course also be one if there is not supposed to be a reply.

i2c data pin b0 and i2c clock pin b1

according to your suggestion:

1) After the read you are transmitting a byte (1). Why?
2) You are not sending a I2C_Stop after the transaction has completed.

Results are similar. In ICD mode,

retval 1
temperature 255

no changes

Re: i2c problem with TC74

Posted: Tue Oct 09, 2012 9:06 pm
by juanlu
Hi Enamul,

I have just tried your flowchart and does not work. Strange symbols on my lcd appears...

Also in ICD mode I always have

temperature 255
retval 0

I have also tried with ID 0x48 and does not work.


I am worried about if there can be any problem with component because I write original code of the learningn course and does not work.

thanks

Re: i2c problem with TC74

Posted: Sun Oct 14, 2012 10:18 am
by poilvert
Hello

I have a similary problem.

I test my flowcode program with I2C and TC74 : all is ok in real.

When I want to test with proteus, it doesn't work. I obtain temperature = 0.
(I obtain 255 only when I have the wrong adress of the I2C component (in proteus)).

If I test with a program made with microchip compiler and proteus all is ok.

Have you got an idea ?

Thanks in advance for your help
FP

Re: i2c problem with TC74

Posted: Sun Oct 14, 2012 10:45 am
by poilvert
Hello Janlu

When I obtain 255, it's when I have a bad ID adress.

You can know the good ID with the datasheet in page 9
5.0 PACKAGING INFORMATION
http://ww1.microchip.com/downloads/en/d ... 21462c.pdf

FP

Re: i2c problem with TC74

Posted: Mon Oct 15, 2012 8:11 pm
by juanlu
Dear Poilvert,

I have already checked the right address. TC74 I use is 5V A0, according to this the right id is 0b1001000.
It is not the problem.

What I agree with you it that seems there are no reply from TC74.

The only idea I have right now is to replace component for a new one.

Thanks for your support,