Dallas 1wire and BS2
Archiver
Posts: 46,084
As usual, Jon is right. The chip will let a BS2SX, BS2, BS1 or any
serial capable device (PC, Mac, PDA...) talk with 1-wire devices.
The DS2401 doesn't know many tricks so many of the interface chip's
features won't get a chance to come out and play. If you've got a
single '2401 you're talking with, your BS2 program can be as simple
as:
'DS2401.BS2: read serial number
Baud CON 396 + 32768 ' 2400 baud, open mode, BS2
Ser_Pin CON 10
' 1-Wire interface chip command codes
reset CON 12
put CON 8
get CON 7
'ROM function commands
Read_ROM CON $33
' variables
in_byte VAR BYTE(8)
' initiate reset-presence sequence
SEROUT Ser_Pin,Baud,25,[noparse][[/noparse]reset]
' send Read ROM to bus
SEROUT Ser_Pin,Baud,25,[noparse][[/noparse]put,1,Read_ROM]
' solicit 8 bytes in response
SEROUT Ser_Pin,Baud,25,[noparse][[/noparse]get,8]
' accept 8 bytes from interface chip
SERIN Ser_Pin,Baud,[noparse][[/noparse]STR in_byte\8]
This program will read the serial ID of virtually any 1-Wire device
into the in_byte array.
There are lots of other functions available in the interface chip to
simplify common command sequences, conveniently handle multiple
devices on the 1-Wire bus, etc.
Regards,
Steve
serial capable device (PC, Mac, PDA...) talk with 1-wire devices.
The DS2401 doesn't know many tricks so many of the interface chip's
features won't get a chance to come out and play. If you've got a
single '2401 you're talking with, your BS2 program can be as simple
as:
'DS2401.BS2: read serial number
Baud CON 396 + 32768 ' 2400 baud, open mode, BS2
Ser_Pin CON 10
' 1-Wire interface chip command codes
reset CON 12
put CON 8
get CON 7
'ROM function commands
Read_ROM CON $33
' variables
in_byte VAR BYTE(8)
' initiate reset-presence sequence
SEROUT Ser_Pin,Baud,25,[noparse][[/noparse]reset]
' send Read ROM to bus
SEROUT Ser_Pin,Baud,25,[noparse][[/noparse]put,1,Read_ROM]
' solicit 8 bytes in response
SEROUT Ser_Pin,Baud,25,[noparse][[/noparse]get,8]
' accept 8 bytes from interface chip
SERIN Ser_Pin,Baud,[noparse][[/noparse]STR in_byte\8]
This program will read the serial ID of virtually any 1-Wire device
into the in_byte array.
There are lots of other functions available in the interface chip to
simplify common command sequences, conveniently handle multiple
devices on the 1-Wire bus, etc.
Regards,
Steve
Comments
to BS2? In particular, I am using a DS2401 1wire device.
Thanks in advance
Lou
lusabi1@aol.com (lusabi is italian for wasabi.)[/font]
writes:
1-wire
to BS2? In particular, I am using a DS2401 1wire device.
The BS2p, about ready to roll out the door from Parallax, has native 1-Wire
and I2C support. ·Documentation is available in the new manual which you can
download from Parallax (www.parallaxinc.com).
-- Jon Williams
-- Dallas, TX[/font]
it for the purpose of a 1-wire master. Although I most likely will buy one,
it wont be for awhile yet (bills :-) so I must utilize what I have .
Thank you though Jon, appreciate the response. Any more info on this topic
will be appreciated. (before I pull what little hair I have left out of my
throbbing head!!!!!)
Lou[/font]
writes:
it for the purpose of a 1-wire master. Although I most likely will buy one,
it wont be for awhile yet (bills :-) so I must utilize what I have .
Thank you though Jon, appreciate the response. Any more info on this topic
will be appreciated. (before I pull what little hair I have left out of my
throbbing head!!!!!)
Steve Parkiss has an SX coprocessor designed to allow Ann non-BS2p to talk
with 1-Wire devices. ·Take a look at: http://home.earthlink.net/~parkiss/
-- Jon Williams
-- Dallas, TX[/font]
L[/font]