• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

i2c bus

Status
Not open for further replies.

udayshanbhag

New Member
hi friends
i want to interface 68hc11 with pic 16f877a
i have decided to use i2c bus
but have no idea how to do that
can anybody help me out???
thanks in advance
 

Nigel Goodwin

Super Moderator
Most Helpful Member
udayshanbhag said:
hi friends
i want to interface 68hc11 with pic 16f877a
i have decided to use i2c bus
but have no idea how to do that
can anybody help me out???
thanks in advance
Why I2C?, it seems a fairly bizarre choice?, and pretty complicated to do a slave - why not use a simple serial connection?. Personally I wouldn't consider using I2C unless it's to access a specific I2C chip.
 

kinjalgp

Active Member
You won't be able to contruct I2C slave using those microcontrollers as they won't be able to meet the bus timings.

You need something faster like FPGA for building an I2C slave. But since your purpose is communication between two uCs, as suggested earlier, serial communication will be the best approach.
 

Exo

Active Member
kinjalgp said:
You won't be able to contruct I2C slave using those microcontrollers as they won't be able to meet the bus timings.
Strange, I've written tons of projects using a pic as an I²C slave (in software). As far as i know there's no timing restrictions on I²C (except for the maximum speed). You can run it as slow as you want, even have a little 10 second pause in between, and it'll still work.
 

kinjalgp

Active Member
Exo said:
kinjalgp said:
You won't be able to contruct I2C slave using those microcontrollers as they won't be able to meet the bus timings.
Strange, I've written tons of projects using a pic as an I²C slave (in software). As far as i know there's no timing restrictions on I²C (except for the maximum speed). You can run it as slow as you want, even have a little 10 second pause in between, and it'll still work.
I was referring to the data rate that I2C specifies (100kbps/400kbps). With software I2C slave, this is not possible to achieve.
Also I think if you try to interface your software slave with any device having hardware I2C port, you will face problems due to speed mismatch.
So if both master and salve are constructed using software then its possible to implement I2C without any trouble.
 

Exo

Active Member
With a pic running at 4Mhz it's possible to do 100kbps i²c, and a pic running at 20Mhz can do 400kbps, no problem!

Only catch off course is that the part cannot do any other things while polling the I²C bus. But that beeing a problem or not depends on the project.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Exo said:
With a pic running at 4Mhz it's possible to do 100kbps i²c, and a pic running at 20Mhz can do 400kbps, no problem!

Only catch off course is that the part cannot do any other things while polling the I²C bus. But that beeing a problem or not depends on the project.
It can do it if you use the I2C hardware, you really need hardware to do slave mode - unless that's ALL you're doing.
 

udayshanbhag

New Member
why i2c in detail

hi
i have to interface a magnetic compass and eeproms with 68hc11...and a bump sensor with pic....and 68hc11 with pic
hence i thought of using i2c
if that can be implemented using simple serial commn..tell me how ..
any links and pdfs etc
my emailid is [email protected]
thanks in advance
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Re: why i2c in detail

udayshanbhag said:
hi
i have to interface a magnetic compass and eeproms with 68hc11...and a bump sensor with pic....and 68hc11 with pic
hence i thought of using i2c
if that can be implemented using simple serial commn..tell me how ..
any links and pdfs etc
Assuming the EEPROM is I2C, then you obviously require an I2C bus to communicate with that, is the compass I2C as well?. This doesn't mean you have to connect the PIC to the bus as well!, although you could if you're very short of pins - presumably the 68HC11 will be master, and the PIC slave?.

Why use the PIC?, why not use the 68HC11 for the bump sensor as well?.
 

udayshanbhag

New Member
re

hi
we have other sensors as well like ir sensor and sonar which are already interfaced with pic 16f877a .... we have to drive dc motors using 68hc11 and many more.....thus we have shortage of pins..
if this can be done with serial commn please help me out
thanks in advance
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Re: re

udayshanbhag said:
hi
we have other sensors as well like ir sensor and sonar which are already interfaced with pic 16f877a .... we have to drive dc motors using 68hc11 and many more.....thus we have shortage of pins..
if this can be done with serial commn please help me out
thanks in advance
If you have two pins free on each processor you can do bi-directional serial comms, if you only have one free on each you can do uni-directional, or (with a bit more work) a form of bi-directional serial.

Details of PIC serial are in my tutorials, but I can't help you one the 68hc11.
 

pike

Member
Why bother with something as complex (and annoying) as I2C. There are only 2 devices, and they dont have to be on the same lines. I think it's best to compromise the I2C unless absolutely nesscessary. Save your brain a ton of work.

BTW: Nigel I like your "technique" there!! 8) ...
Umm you do know what i mean dont you???
 

pike

Member
Your chinese symbol as your avatar.
I'm surprised, you use it but don't know the meaning.
I'm far worse off though, i cant read chinese. Barely speaking it... :cry:
 

Nigel Goodwin

Super Moderator
Most Helpful Member
pike said:
Your chinese symbol as your avatar.
I'm surprised, you use it but don't know the meaning.
I'm far worse off though, i cant read chinese. Barely speaking it... :cry:
As far as I'm aware it means 'art' (or obviously 'technique'), it's the 'Jitsu' in 'Ju Jitsu' ('gentle art'), in which I hold a 3rd degree black belt.

It's also Japanese kanji (Ju Jitsu is a Japanese martial art), but apparently they just copied the Chinese kanji - so they are essentially the same :lol:

I'm impressed you knew what it was!.
 

bbiandov

Member
Exo, I was wondering the same thing based on the spec- I2C does not have minimum so I figured I will do some real slow stuff but never knew if the spec is "real" meaning that there isnt really any timeout? So do I understand you correctly- you HAVE DONE this and it really works as slow as you can be?

Thanks
~B
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top