Shop OBEX P1 Docs P2 Docs Learn Events
DS1822 Temp Sensor and BS2p24 — Parallax Forums

DS1822 Temp Sensor and BS2p24

WavemanWaveman Posts: 20
edited 2007-07-07 17:30 in BASIC Stamp
I want to interface four DS1822 temp sensors using 1-Wire to a BS2p24. I know that I need a pullup resistor and
can anyone tell me if one 4.7k Ohm will do for the all DQ lines tied together?

Thanks,

W

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-07-03 06:13
    That's right, one 4.7kohm for all of them, tied together. If the wires are very long, then use a lower resistance, down to 1 kohm.

    Plan how you are going to write your program before you wire them all up. Do you want the program to be shorter and easier? If so, then attach the individual DS1822s, one at a time and out its address in advance, before you wire them all up in parallel.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • WavemanWaveman Posts: 20
    edited 2007-07-06 19:16
    Hello Tracy,

    Shorter and easier is the way I want to go. Thank you and any code examples you may have for reading more than one DS1822? The BS2 reference manual only has example for one DS1822.

    Tnx,

    W
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-07-07 17:30
    Hi Waveman,

    Each onewire device has a unique serial number. When you request data from a DS1822, the command will start by sending out a serial number. It does not matter how many onewire devices are attached, only the one with that serial number will respond. So the first thing for you to do is to catalog, one at a time, the serial numbers of all the 1822s you have. Then when you connect them all to the single bus, you will already know what is there, and you can easily modify the program to address them one at a time. You will store the addresses of the 1822s as DATA or as CONstants, or simply hard code them in the program.

    The program you have probably includes something like the following to read out the serial number:
    DisplayROM:
    DEBUG "Dallas 1-Wire ID : "
    OWOUT OWpin,OW_FERst,[noparse][[/noparse]ReadROM] ' send Read ROM command
    OWIN OWpin,OW_BERst,[noparse][[/noparse]STR romData\8] ' read serial number & CRC
    FOR idx = 0 TO 7
    DEBUG HEX2 romData(idx)," " ' show ID, serial num, CRC
    NEXT
    



    That kind of routine works only when one onewire device at a time is connected. Those are the numbers you need to write down, then you can use them when several are on the line.

    There is a procedure of enumeration for figuring out blind the serial numbers of devices when several are on the line, but it is a much more complicated.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.