Shop OBEX P1 Docs P2 Docs Learn Events
Mulitple IC2IN/OUT? — Parallax Forums

Mulitple IC2IN/OUT?

CRussellCRussell Posts: 15
edited 2008-08-05 00:00 in BASIC Stamp
Was reading through the manual online and noticed that the IC2IN/OUT commands use 2 pins (figured that much).· However, it says, in the facts sheet at least, that it uses either pin 0/1 or pins 8/9.· I'm not sure if I'm reading that right.· The question is, if I have 4 devices that I want to send IC2IN/OUT commands to, can I set them up on multiple pins?· IE, can I use IC2IN/OUT on pins 0+1, 2+3, 4+5, and 6+7?· I know I could connect all 4 I2C devies to the same lines and just give the different address, but my chips all have the SAME address!· Hence the need for seperate pins on the BS2p40 for each device.· Can the STAMP do this?· Or am I limited to only 2 I2C devices as the manual somewhat implies?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-01 20:52
    You are limited to only two I2C busses, 0/1 and 8/9 unless you're using a BS2p40 which has two banks (MAINIO and AUXIO) of 16 I/O pins, then you can have four I2C busses, two in each bank. They're still addressed as 0/1 and 8/9. It's just that you can have a bank selector statement before the I2CIN/I2COUT statement.
  • CRussellCRussell Posts: 15
    edited 2008-08-01 20:56
    Perfect, exactly what I needed to know (and I am using the BS2p40). All I needed was 4 busses, which is perfect. Thank you!
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2008-08-02 16:45
    Az,

    FWIW, watch for two things on your I2C devices:
    1) Address pins with which you can specify different addresses (e.g. MCP23016 I/O extender).
    2) I2C commands that let you change the devices address (e.g. BlinkM "smart" LED).

    With the latter you'd put each device on the I2C bus and change its address, one at a time.
    Afterwards, everyone can ride the same bus. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock <=> AE5AE
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • CRussellCRussell Posts: 15
    edited 2008-08-03 16:03
    I wish it were only that simple. I'm using 4 LTC1695's (SMBus/I2C Fan Speed Controller) and the only ones my supplier carries all have the same burned in address of 1110100, hence needing 4 different I2C ports. I need to control them independently, so they all have to be on different busses =/
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-08-03 17:37
    I2Cselect2.jpg
  • CRussellCRussell Posts: 15
    edited 2008-08-04 15:33
    Wow, yah know, that would probably fix that issue. I assume 4K7 means 4.7k? I think where my problem is, is that I made an assumption without knowing all the facts (nothing new there unfortunately..). From what I understood, I give me little LTC1695 a command to output X voltage with the I2C data line and it dutifully does that. The assumption, was that I had to keep telling it to put that voltage out. I assume now (see, I did it again...) from looking at this switch diagram, that I only need to tell it what voltage to put out once, and I don't need to talk to it again until I want to change it? That would certainly change my diagram some...And thank you for the diagram PJ, I appreciate it.
  • Andy FoxAndy Fox Posts: 46
    edited 2008-08-04 16:32
    I think a 74LS77 4-bit D Latch would also serve the same purpose and might be easier/cheaper to get a hold of.
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2008-08-04 17:22
    Andy,
    A 74xx77 wouldn't work in this circuit because it's not trying to latch any data -- just switch one data
    stream (SDA) to one of four devices, the LTC1695's.

    Personally, I think I'd use something like half of a 74xx155 1-of-4 decoder/demultipler to reduce the
    pins needed from the Stamp to SDA, SCL, and two bits for selection. There might be a slightly better
    part but I don't have my TTL Data Book handy to browse through. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock <=> AE5AE
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-04 17:57
    Strictly speaking, I2C is a bidirectional bus. SDA for sure has to be able to go from master to slave and back again. Even SCL has to be bidirectional if clock stretching is to work. The 74HC4066 allows for the bidirectionality. You could also switch the SCL line and, if you're not using clock stretching, you could use a 74HC155. Since only one LTC1695 would be selected at a time, they could share the SDA line.
  • Andy FoxAndy Fox Posts: 46
    edited 2008-08-04 18:36
    Fe2o3Fish said...
    Andy,
    A 74xx77 wouldn't work in this circuit because it's not trying to latch any data -- just switch one data
    stream (SDA) to one of four devices, the LTC1695's.

    I figured the latches could be used as enable lines--only unlatch the channel you want to use and have the inputs tied together like the 4066, but as Mike pointed out, I forgot about the SDA needing to be bi-directional anyway.

    EDIT: My fault--when I first looked at the 74LS75/77 I thought each latch had its own enable pin, but I see they are shared 2 x 2.

    Post Edited (Andy Fox) : 8/4/2008 11:15:56 PM GMT
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2008-08-04 22:30
    Yup, yer right Mike. (excuse me a sec'... <smack my forehead... HARD> OK, I'm back)
    That's what I git for posting before midnight. :-\

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock <=> AE5AE
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • CRussellCRussell Posts: 15
    edited 2008-08-04 22:43
    Heres an off the side question...can I use those 74xx4066 as a switch, other then for logic? IE can I throw one of those somewhere and run external circuits off of it? I'm thinking, not more then 100mA? Or would I be better off using some MOSFET's (which I'm using already in the design) to do something along those lines? I can't seem to find how much I can sink/source out of one of those things before it releases its magical blue smoke to the atmosphere (as my original EE teacher taught us, the blue smoke is what makes chips work, and if you anger the chip, it'll release its blue smoke to spite you, and it'll stop working! ... btw that's a joke he told us, I know better...).

    And on a very side segway, I was noticing the schematics available for the BS2p40 on the site. Is that diagram sufficient enough to create the BS2p40 with surface mount parts instead of the manufactured version via OEM parts? All I need is the EEPROM, the interpreter, and the set of other items (resonator, resistors, etc) in the diagram? It would make life easier for us out here if I could scrap the very large DIP-40 package this thing comes in for the very small surface mount variety. Or is there something else that I need to take into consideration with that diagram?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-08-05 00:00
    The 4066s (all varieties) are low-current devices for analog signal mux/demux (switching), but they work for digital, too.· I've done this sort of thing,·but not with I2C.· Another option is the CD4051 (74HC4051,·etc.)· I have lots of 4066s on hand.· If you need to conserve an I/O pin, then choose the 4051.· Same outcome.
Sign In or Register to comment.