One wire devices with the BS2

bob kruggelbob kruggel Posts: 50
edited 2005-09-17 - 19:53:58 in BASIC Stamp
Does anyone have code written for using one wire devices with the BS2? I know the BS2P includes one wire commands, but I want to interface a homework board (surface mount BS2) to the Parallax thermocouple ·board. I'm willing to attempt this task myself but would be much happier if I could use someone else's code.
Bob Kruggel


  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-16 - 22:20:57

    ·· You cannot use a one-wire device on the BS2 without a converter of some kind.· I know Dallas/Maxim has a chip (I think the DS2480) which will allow this, but I don't believe it can be done directly.

    Chris Savage
    Parallax Tech Support
  • metron9metron9 Posts: 1,100
    edited 2005-09-17 - 19:53:58
    Unless you write the receive code on the receiveing device.
    I use this morse code type method sending from a BS2 to a mega48 microcontroller chip.

    A dot dash = 0
    a dash dot = 1

    The dash and dot are both low signals but the lenght of time is measured on each low signal.
    The send device should keep a high pin status unless sending.

    I set up a loop on the receiveing device to poll for a high pin
    Pin High > wait for pin to go low > pin low > count and store how long it's low > pin high > wait for next low > pin low >again count and store time low > pin high > done with first two bits

    Now I have 2 variables B1 and B2
    If B1<B2 then bit is 0
    If B1>B2 then bit is 1

    Store the bit and continue polling for next sequence. The device would just keep passing along the bits and doing whatever your bit stream is suppos to do.

    So you don't have to have a clock pin, and you don't even have to know the bit rate because the device measures the time of two low signals to get one bit of information.

    This assumes your receiveing device is as fast or faster than your sending device.
  • Or this post for CM2302
  • PublisonPublison Posts: 11,828
    edited 2019-10-12 - 17:59:14
    This thread is 14 years old.
  • So this means two threads on BS2 and the One-Wire are now adults. Nu? They are still relevant. Let us not bandy semantics.

    Mascot away and no messages are being accepted.
  • I was just saying because the first three posters have not been on in years.
Sign In or Register to comment.