CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

problem in using i2c
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Sun Jul 05, 2020 10:34 am     Reply with quote

Ok, what do you mean by ???? in the bus scanner

Did any of the other text show up? If not that means your baud rate or clock set up is wrong.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Sun Jul 05, 2020 10:48 am     Reply with quote

Problem is that this could simply be a Proteus problem.
However lots of things apply:

What pull up resistors have you got on the I2C bus?.
Test the virtual terminal. Does it display a basic 'Hello World' message
correctly.
You are specifying HS, which implies an external 16MHz crystal is needed.
Have you got this. Have you setup the simulation to have a 16Mhz
clock?.

There are further issues with your code. The device address of a standard
TC74, is 0x9A/9B. Now The optional addresses available are:

0x90/91 V0
0x92/93 V1
0x94/95 V2
0x96/97 V3
0x98/99 V4
0x9A/9B V5 (DEFAULT)
0X9C/9D V6
0X9E/9F V7

Have you reprogrammed the emulation to the correct addresses?.
Remember the Proteus address needs to be in 7bit format. So:
0x48,49,4A etc..

Searching the web, there are lots of reports of people not being able to get
the TC74 to work in Proteus. This is typical. Almost certainly the
simulation itself is faulty. This is why we say "Proteus problem - go away"...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 05, 2020 11:16 am     Reply with quote

His circuit is wrong. On the bottom sensor, he has SCL and SDA
connected together.

His schematic has several unnecessary corners in the lines,
making it confusing to read. Clean up the schematic.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Sun Jul 05, 2020 11:54 am     Reply with quote

Ouch.
Doesn't help things to work.... Surprised

Also 10K is too large for the pull up. at 100KHz, even 4K7 is borderline.
Proteus will probably ignore the real line capacitance, but for four
slaves, I'd be looking at 2K2.

Also, the I2C scanner program can't give what he is showing, which
presumably means he has changed it. Sad
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jul 05, 2020 3:32 pm     Reply with quote

He's one of the first to ACTUALLY show a xtal and caps ! But the lower xtal/cap connection goes to two pins ! One's correct the other isn't (I supect a slip of the mouse tail ??).

Still no VDD and VSS connections so in the real world it won't work.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Jul 06, 2020 12:52 am     Reply with quote

Don't get 'hooked' on the Vdd/Vss thing with Proteus. One of the options
is to make these connections automatically to the defined pins, so it is
normal for them not to be shown. The track called Vss is automatically
connected to all the Chip pins called Vss, and these are usually invisible.
The same for Vdd.
It gets 'fun', when you have board sections with separate Vss/Vdd supplies
(so things like isolated sections running off separate supplies), which then
require you to go into the settings, and allocate these), and boards with
multiple Vdd rails (so 5v and 3.3v sections for example), but on a single
supply board, what I like to do/see, is have the supply shown coming into
the schematic, and labelled Vss/Vdd, and then list the pin numbers for the
invisible connections, but that is just because (like you), I don't like not
being able to actually 'see' the connections..... Very Happy
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jul 06, 2020 4:36 am     Reply with quote

I've always thought it'd be 'interesting' to hand a class of students a Proteus schematic and have them breadboard the design, as drawn.
I seriously doubt any Proteus 'schematic' would work.
Yeah, a pet peeve of mine but I remember being docked 5 points for NOT having an on-off switch between a battery and the device on the final exam.
That was a 1/2 century ago, long before PICs were even thought of.....sigh.
Details, it's the little details that'll cause the most problems.
Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Jul 07, 2020 12:48 am     Reply with quote

It was quite common on schematics (long before Proteus), to have the
main schematic part, and then at the bottom of the drawing, a pair of
power lines, with all the capacitors shown between then. This is what I
do on Proteus schematics, adding to these lines, labels giving all the pins
they connect to. This way you can look along the power lines, and have
details of where they actually connect. I think unless you do this, the
drawing is really 'not complete'. Unfortunately doing this is something that
seems not to be being taught... Sad
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Tue Jul 07, 2020 5:16 am     Reply with quote

Ttelmah wrote:
It was quite common on schematics (long before Proteus), to have the
main schematic part, and then at the bottom of the drawing, a pair of
power lines, with all the capacitors shown between then. This is what I
do on Proteus schematics, adding to these lines, labels giving all the pins
they connect to. This way you can look along the power lines, and have
details of where they actually connect. I think unless you do this, the
drawing is really 'not complete'. Unfortunately doing this is something that
seems not to be being taught... Sad


Funny thing is during mechanical engineering school we had a course for all of these electronic things that are "not taught in school". And I've subsequently found that it's true that many of the things taught in that class were not taught elsewhere except on the job.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Jul 07, 2020 7:11 am     Reply with quote

Absolutely right.
One thing that is vital for a real schematic in use, is that people can tell
where everything does actually connect. The Proteus standard of hiding
the supplies makes the result 'useless' for an engineer in the field, as
opposed to the PCB generation (where these connections are known about
by the 'package').
In engineering, actually 'saying' on the drawing what units are used, what
tolerances etc., need to be, are things that the 'real world' teaches.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group