Shop OBEX P1 Docs P2 Docs Learn Events
Why IC2 ? ? ? — Parallax Forums

Why IC2 ? ? ?

kenwtnkenwtn Posts: 250
edited 2006-02-06 15:49 in BASIC Stamp
··· Ok I am a Newbie and sure do not know as much as I should about electronics. But I keep seeing and hearing about IC2 which as I understand it is 2 wire serial communications between Masters and Slaves Modules. Now for my question why is IC2 better than simple 1 one wire serial communications, other than using up another pin and running another wire? In tests I have run I have connected multiple BS2 stamps together with a single serial communication line and assigned the modules or BS2 stamps a device ID. There where no apparent problems that I could see when doing it this way VS IC2.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-02-05 14:43
    The main advantage is that the protocol (the format of the information transferred, the electrical specification of the pulses, etc.) is standardized (by Philips) and there are all sorts of parts out there (A/D and D/A converters, parallel port expanders, memories, etc.) that follow the standard. It's fast (400kHz) and reliable over short distances (inches) and you can daisy-chain several parts on one pair of ports since the protocol includes device addresses.
  • kenwtnkenwtn Posts: 250
    edited 2006-02-05 14:50
    So really the only advantage is Philips came up with a standard and many manufactered modules comform to that standard? Since I was able to daisy-chain a single line and make the BS2 stamp addressable by issuing something like "!' let all module know a command is coming ""A" or "B" or "C" etc. is next character sent telling which BS2 to act on the request.
  • BeanBean Posts: 8,129
    edited 2006-02-05 15:55
    Serial communication is meant to be from one piece of equipment to another piece of equipment.

    I2C is meant to be used between devices on a single piece of equipment.

    I2C is much faster and does not require a precise clock on both devices.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "Ability may get you to the top, but it takes character to keep you there."
    ·
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-05 16:09
    kenwtn --

    Philips invented·I2C for use between microprocessors and control circuits in their televisons and VTRs, but not as an interconnect between consoles.
  • kenwtnkenwtn Posts: 250
    edited 2006-02-05 18:34
    ·If both are serial based how is it that one can be faster than the other?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-05 18:42
    I2C is a synchronous protocol; while this requires an extra line (SCK - clock) it prevents entities from being out of sync with each other as can happen with asynchronous serial devices. I2C = Inter-Integrated Circuit, it's a bus topology originally designed to connect chips on the same board.

    Keep in mind that there will nearly always be more than one viable solution to any problem. I2C is a nice solution in many cases because of its acceptance and the wide variety of parts available.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-06 14:01
    To expand on the whole synchronous/asynchronous issue. Besides the advantage of providing a signal telling the recieving device when to clock in the data (reduces bit error rate (BER)), there are many other benifits to using a synchrounous communication:
    1. A synchronous communication protocol can be designed to support multiple masters (more than one device can issue requests).
    2. A data transfer can be paused by either the master or slave, meaning a transmission can occur at the highest common data rate and there is no problem of communication taking place between a device capable of very high speed transfers and a device only capable of low speed transfers.
    3. There doesn't have to be a preset standard data rate since the clock signal provides the information of how fast the data is being transfered.
    4. Much higher data rates are possible.

    Asynchrounous communication can implement some of the above features, but always at a cost. Like #3 can be done asynchrously, but it requires a datarate synchronization packet which consumes bandwidth.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • kenwtnkenwtn Posts: 250
    edited 2006-02-06 14:13
    ··· I wish to thank everyone for their views and giving me the pros and cons of IC2 VS Single Line serial Communication. The robot I have in mind will be comprised of many modules some purchased and others home built. The purpose of my question is I am planning out a cable that will run through-out from module to module.

    ·· From the replies that I have gotten I am now convinced of going with two wires and using IC2 for module to module communication.

    ·· Agian I want to thank all of you that replied.
  • kenwtnkenwtn Posts: 250
    edited 2006-02-06 14:15
    Would also be helpful if I spelled it correctly I2C instend of IC2. I hope I wire better than SPELL.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-02-06 14:58
    I'm not sure of the distance that I2C will support. I believe it was designed as a 'local' bus -- local to a board. It probably won't work too well going from board to board to board.

    And you dismiss that 'speed' advantage way too easily. In engineering, we make trade-offs all the time between cost, simplicity, and speed. The BS2 implements the RS-232 standard signaling for any pin, with great simplicity. But the speed is limited to 56K baud, and 9600 baud is better. And it's nice to be able to use one wire (ok, three -- TX, RX, and GND) and just have the signal 'work'.

    The BS2 does NOT implement I2C as flexibly as it implements RS-232. Even the 'three-wire' SPI standard implemented on the BS2 by SHIFTIN and SHIFTOUT has the 'master-slave' problem -- the BS2 can ONLY act as an SPI 'master', NOT an SPI 'slave'.

    If I was creating a new design with a BS2, I would implement a 'bus' using the SERIN/SEROUT signals (as it sounds like you have already done, using "!" as an attention character). I would stay away from trying to use I2C as a 'general purpose' bus between boards -- usually it is used to reduce wire count for local EEPROM/UART IC connections.
  • kenwtnkenwtn Posts: 250
    edited 2006-02-06 15:15
    I am a bit confused by your reply are you suggesting I go with my first design and use a single wire? I do know that works as I did connect sevral boards togher and it seemed to work rather well. I don't know the distance the boards that I connected were only seperated by couple of feet, but for what I have planned that may be enough. The robot I am building will look somewhat line the Mars Explorer and instead of exploring Mars will explore my backyard. I hope to add wireless video and commication at some point. Right now I am planing to build module by module as time and money permits. Each module will carry-out a special function. Example I plan a module for range finding and direction. This would be a slave module that when asked by the master for a recommended direction it will provide one. Or if the robot is in danger of running into somethnig it will alert the master. All of this is still in early planning stage and open for change as I continue to learn.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-02-06 15:49
    Yes, I am absolutely recommending you go with your first design, and use a single wire. It's simple, inexpensive, you already know it works, and it gives you the most flexibility for the future.
Sign In or Register to comment.