Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > General Electronics Chat

Notices


General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion?

Reply
 
LinkBack Thread Tools Display Modes
Old 2nd June 2008, 02:25 PM   (permalink (permalink))
Default Use Of Interfaces

i am confused over when to use interfaces like i2c..so i am giving you a small example ..please explain it to me on the basis of it..

suppose i am making a line follower(a bot which is programmed to follow a black line) . i m using 4 sensors whose output would be connected to 4 comparators giving digital 0s and 1s depending on input voltage. now these 4 comparators are connected to the microcontroller which works according to the combination of these digital inputs.
1) do we require i2c between sensor and comparator.
2) do we require i2c between comparators and microcontroller.(and how do we make sure that all the 4 output data of comparators reach microcontroller at the same time)

if none of these require the use of i2c than please explain when it is used...
tech_vaibhav_eee is offline  
Reply With Quote
Old 2nd June 2008, 02:35 PM   (permalink (permalink))
Default

Quote:
Originally Posted by tech_vaibhav_eee View Post
i am confused over when to use interfaces like i2c..so i am giving you a small example ..please explain it to me on the basis of it..

suppose i am making a line follower(a bot which is programmed to follow a black line) . i m using 4 sensors whose output would be connected to 4 comparators giving digital 0s and 1s depending on input voltage. now these 4 comparators are connected to the microcontroller which works according to the combination of these digital inputs.
1) do we require i2c between sensor and comparator.
2) do we require i2c between comparators and microcontroller.(and how do we make sure that all the 4 output data of comparators reach microcontroller at the same time)

if none of these require the use of i2c than please explain when it is used...
hi,
For the 4 sensors/comparator outputs which are '0 or 1', use 4 input pins on a PIC PORT.
If the external comparators just have a '0 or 1' depending upon the light seen by the sensor, they are not I2C compatible.

Do you follow.?
__________________
Eric
"Good enough is Perfect"

PIC tutorials:
Gramo's: www.digital-diy.net/
Bill's: www.blueroomelectronics.com/
ericgibbs is offline  
Reply With Quote
Old 2nd June 2008, 02:41 PM   (permalink (permalink))
Default

Quote:
Originally Posted by tech_vaibhav_eee View Post
i am confused over when to use interfaces like i2c..so i am giving you a small example ..please explain it to me on the basis of it..

suppose i am making a line follower(a bot which is programmed to follow a black line) . i m using 4 sensors whose output would be connected to 4 comparators giving digital 0s and 1s depending on input voltage. now these 4 comparators are connected to the microcontroller which works according to the combination of these digital inputs.
1) do we require i2c between sensor and comparator.
2) do we require i2c between comparators and microcontroller.(and how do we make sure that all the 4 output data of comparators reach microcontroller at the same time)

if none of these require the use of i2c than please explain when it is used...
1. sensor has analog output and it "does not know how to speak i2c" unless it is special type of sensor (for e.g. AD convertor like PCF8591 but then you will not connect it to comparator)
2. NO, as you wrote, your comparators are returning 0 or 1 so you connect them to digital input of your uC , your 4 comparators are connected to 4 different digital inputs that you can read "in the same time"

i2c is used for communication between 2 devices. it is one of the protocols that can be used for that purpose. for example, if you are communicating with other i2c device (for e.g. port extender or i2c eeprom or i2c lcd driver or ...) then you use i2c protocol to communicate between your uC and the "device" that support that protocol ... different devices support different protocols, for example if you are to communicate with PCF8591 (AD/DA converter) you need to use i2c protocol, or if you use DS1307 real time clock you need to "ask for time" using i2c protocol, on other hand if you want to check temperature from DS1820 you need to use 1wire protocol, or if you DS1305 to check the time you need to use SPI protocol ...

All this different protocols are different, some use 1 some 2 some 3, 4 or more lines, some are differential, other digital, some work only on short distances (i2c) some work on long distances (CAN), some are relativly slow (1wire, i2c) other can be quite fast (SPI) ... in general, you choose protocol based on all this parameters (speed, distance, noise resistance, type of devices you want to connect)

I hope this gives you some perspective.. search a forum, you will find quite a lot about i2c and other protocols
__________________
http://www.it4um.com
arhi is offline  
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Latest
push button array interfaces to micro fvnktion Micro Controllers 1 22nd April 2008 02:50 PM
nokia 5110 interfaces with pic16f877 to send and recieve sms monaleza Micro Controllers 0 22nd February 2008 05:05 PM
Premade Interfaces (Screen+Keys) ?? iso9001 Micro Controllers 6 19th December 2007 06:18 AM



All times are GMT. The time now is 03:14 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.