i2c problem with TC74

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
juanlu
Posts: 8
Joined: Fri Sep 14, 2012 5:05 pm
Contact:

i2c problem with TC74

Post 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,

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: i2c problem with TC74

Post 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
Enamul
University of Nottingham
enamul4mm@gmail.com

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: i2c problem with TC74

Post 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...
Attachments
i2ceprom.fcf
(12.03 KiB) Downloaded 417 times
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

juanlu
Posts: 8
Joined: Fri Sep 14, 2012 5:05 pm
Contact:

Re: i2c problem with TC74

Post 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?
Attachments
ElektorCourse 1021 Thermometer.fcf
(8 KiB) Downloaded 378 times

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: i2c problem with TC74

Post by Enamul »

Hi,
I have changed few things..let us know how it's behaving..
Attachments
ElektorCourse 1021 Thermometer.fcf
(9.5 KiB) Downloaded 401 times
Enamul
University of Nottingham
enamul4mm@gmail.com

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: i2c problem with TC74

Post 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.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: i2c problem with TC74

Post 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
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: i2c problem with TC74

Post 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?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: i2c problem with TC74

Post 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.
Enamul
University of Nottingham
enamul4mm@gmail.com

juanlu
Posts: 8
Joined: Fri Sep 14, 2012 5:05 pm
Contact:

Re: i2c problem with TC74

Post 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
Attachments
ElektorCourse 1021 Thermometer kersin suggestion.fcf
(8 KiB) Downloaded 375 times

juanlu
Posts: 8
Joined: Fri Sep 14, 2012 5:05 pm
Contact:

Re: i2c problem with TC74

Post 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

poilvert
Posts: 5
Joined: Tue Jan 26, 2010 11:23 am
Contact:

Re: i2c problem with TC74

Post 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

poilvert
Posts: 5
Joined: Tue Jan 26, 2010 11:23 am
Contact:

Re: i2c problem with TC74

Post 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

juanlu
Posts: 8
Joined: Fri Sep 14, 2012 5:05 pm
Contact:

Re: i2c problem with TC74

Post 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,

Post Reply