One wire devices with the BS2
bob kruggel
Posts: 50
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
Bob Kruggel
Comments
·· 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
csavage@parallax.com
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.
Mascot away and no messages are being accepted.