Shop OBEX P1 Docs P2 Docs Learn Events
Several signals — Parallax Forums

Several signals

lindblindb Posts: 10
edited 2005-03-03 19:12 in BASIC Stamp
Hello,

Is there any way to read several different input signals (using RC-time) through one pin on Bs2sx?

Comments

  • Tom WalkerTom Walker Posts: 509
    edited 2005-03-02 14:35
    This is really more of a circuitry/hardware question. The Stamp will happily TRY to execute the RCTIME on any pin (once you've taken the pin high and called RCTIME, it will make the pin an input and try to count until it sees the input transition to low), but if you're circuitry is not VERY well thought-out, you're probably just going to be initiating a hair-pulling exercise.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    XYZZY...PLUGH...*poof*
  • lindblindb Posts: 10
    edited 2005-03-03 19:05
    But can I use one pin to read a signal from two or more sensors? My problem is that my application must have more sensors than available on BS2sx circuit.
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-03-03 19:12
    If the sensors support SPI (aka 'three-wire' ) communication (basically clock-line, data-in, and data-out, with Ground assumed) then you can use the SHIFTIN/SHIFTOUT commands.

    If the sensors support I2C, then I believe only the BS2p and BS2pe modules (NOT the BS2sx) support that.

    Either of these protocols are "serial bus" protocols. SPI lets you use an additional 'select' pin to choose which chip on the SPI bus you want to talk to. I2C uses internal addressing (I believe) in the chips on the bus to select which one you want to talk to. Either way, you can then have multiple devices on the same 3-wire bus.

    And you can always use the 74HCT164 and 74HCT595 as expanders, again using SHIFTIN/SHIFTOUT.
Sign In or Register to comment.