PDA

View Full Version : Several signals



lindbäck
03-02-2005, 07:32 PM
Hello,

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

Tom Walker
03-02-2005, 10:35 PM
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*

lindbäck
03-04-2005, 03:05 AM
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.

allanlane5
03-04-2005, 03:12 AM
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.