4
\$\begingroup\$

The question was:

I want to read temperature from TC74 using I2C module of PIC16F887, however, in Proteus
simulation, I see noises in I2C Debugger Tool's output.

It told me that I had "Spurious SCL transition". Any other info about the question such as schematics, code and screenshot can be found in the older revisions.

The problem is fixed after adding a 4us delay after a restart condition as it is stated in the datasheet as:

START Condition Hold Time - Min: 4us

START Condition Setup Time(for repeated START Condition) - Min: 4us

STOP Condition Setup Time - Min: 4us

That means that we should always read the datasheet thoroughly first. I am guessing that the reason people in the internet don't have any error when they don't obey those wait times is that their clock speed is low and they don't need to put a delay in the uC.

Working code and any other information of this post can be found in the older revisions of it. To see the final version of question before this shrinking, simply go to this page.

\$\endgroup\$
  • 1
    \$\begingroup\$ I have converted everything to embedded images, you probably should have cropped them down for us. About your question, you haven't said what you have tried to do to fix it. It can be great help to include that info. \$\endgroup\$ – Kellenjb Jul 22 '11 at 18:15
  • 2
    \$\begingroup\$ The images are fine, guys. I've cropped them down, though. Remember: It's far better that we get a lot of information than that we get too little! I'd take a dozen questions with screenshots that needed tighter cropping over one "It's not working, can you post code that does?" question. \$\endgroup\$ – Kevin Vermeer Jul 25 '11 at 12:48
  • 1
    \$\begingroup\$ @Kevin Vermeer - Thanks for your care on the question :) \$\endgroup\$ – abdullah kahraman Jul 25 '11 at 14:11
  • 1
    \$\begingroup\$ The problem may be in the reception mode. According to the datasheet, "Master mode reception is enabled by programming the Receive Enable bit, RCEN (SSPCON2 register). The Baud Rate Generator begins counting, and on each rollover, the state of the SCL pin changes (highto- low/low-to-high) and data is shifted into the SSPSR. After the falling edge of the eighth clock, the RCEN bit is automatically cleared, the contents of the SSPSR are loaded into the SSPBUF, the BF bit is set, the SSPIF flag bit is set and the Baud Rate Generator is suspended from counting, holding SCL low." \$\endgroup\$ – abdullah kahraman Jul 25 '11 at 14:15
  • 1
    \$\begingroup\$ @abdullahKahraman, have you attempted building this? There is always a chance a simulation is at fault. \$\endgroup\$ – Kortuk Jul 25 '11 at 16:06
2
\$\begingroup\$

I don't know what you mean by "Proteus simulation". In any case, there are some obvious problems in the schematic. First, it's clearly missing a bunch of connections, so we can't tell what is really hooked up. You are getting pins wiggling, so there must be power, that is not shown. That leaves the question of what else is not shown. And no, don't say it's all hooked up right and it doesn't matter. On closer inspection, the PIC doesn't even have power and ground pins at all in the schematic. Fix all these obvious things before proceeding.

Why the 10 kΩ pullups? Those can be OK for IIC, but will limit the bus speed. What is the IIC clock rate?

What voltage is Vcc? How is the PIC being clocked? If this is a simulation, what does the real hardware do? What is the "I2C" block in the top right corner of the schematic? If you're having a problem between a PIC and another device, remove everything else from the bus during debugging.

I realize this probably should have been a comment, but there was too much to ask to fit into a comment.

\$\endgroup\$
  • \$\begingroup\$ Hello, Proteus is a simulation program from Labcenter Electronics. The connections that are missing (such as MCLR and OSC1) are not needed in Proteus, I made lots of simulations without them and they worked fine. TC74 works at 100kHz and my PIC works at 20MHz. I have changed the value of the pull-up resistors and it didn't work. That I2C block is a debugger tool in the simulation program. I have no real hardware for now, because I don't have TC74 IC. Thanks for your answer :) \$\endgroup\$ – abdullah kahraman Jul 25 '11 at 12:38
  • 1
    \$\begingroup\$ @AbdullahKahraman, add interesting information like this to the question! \$\endgroup\$ – Kortuk Jul 25 '11 at 16:05
  • \$\begingroup\$ @Kortuk, no worries, I will not forget it the next time :) \$\endgroup\$ – abdullah kahraman Jul 25 '11 at 16:20
0
\$\begingroup\$

The problem in the question is solved and the details can be found in the post itself or the last post before the actual one. This answer is just to flag this question as answered so that it doesn't populate unanswered questions list for nothing.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.