i2c problem with TC74
i2c problem with TC74
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,
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,
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: i2c problem with TC74
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
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
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: i2c problem with TC74
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 475 times
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
Re: i2c problem with TC74
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?
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 439 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: i2c problem with TC74
Hi,
I have changed few things..let us know how it's behaving..
I have changed few things..let us know how it's behaving..
- Attachments
-
- ElektorCourse 1021 Thermometer.fcf
- (9.5 KiB) Downloaded 448 times
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: i2c problem with TC74
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.
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
― C.S. Lewis
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: i2c problem with TC74
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
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
― C.S. Lewis
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: i2c problem with TC74
To which PIC pins is your TC74 connected?juanlu wrote:Hi,
It is needed to read temperature value of TC74 and then show the results in lcd wiht pic 18f4455.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: i2c problem with TC74
I was following datasheet..datasheet is saying so.. But the following also true and I might be wrong depending on his device..According to the message from juanlu the device ID is 0x48, why have you changed it to 0x4d in your code?
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
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
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 429 times
Re: i2c problem with TC74
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
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
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
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
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
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
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,
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,