Shop OBEX P1 Docs P2 Docs Learn Events
multiple 1-wire temp sensors — Parallax Forums

multiple 1-wire temp sensors

jyoungjyoung Posts: 16
edited 2006-12-27 00:06 in Propeller 1
I have been searching, and trying to come up with a way to read the temperature from different i2c components (ds1822). I can get the correct temperature from one device but not from multiple devices. If any one has a direction they can point me in I would appreaciate it. Thanks in advance.

Post Edited (jyoung) : 12/26/2006 9:29:53 PM GMT

Comments

  • jyoungjyoung Posts: 16
    edited 2006-12-26 19:53
    I think I have been confused about 1-wire and i2c, it appears there is a difference and the ds1822 that I am trying to use is a 1-wire device.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-26 20:17
    There is a One-Wire object in the Propeller Object Exchange. If you have a PBasic Manual, there are some One-Wire commands discussed there. Basically, you have to address the device first. Each device has a unique device address. It's normally stamped on the device itself. You can retrieve it from the device easily if you have only one device connected to the controlling processor. I've sometimes set up a Stamp on a BS2p development board (with the connector for a 16x2 LCD display) with a little program just to display the 1-Wire address and device type of any device plugged in. It's handy when you have a little bag of 1-Wire parts to identify.

    Anyway, you address then device, then send and receive commands and data. The device stays addressed until it's reset (like if power goes off) or another device gets addresssed.
  • jyoungjyoung Posts: 16
    edited 2006-12-26 21:33
    I appreaciate the direction and now I understand how they work. I am trying to get the code correct to address the device. I can't seem to find the "match_rom" routine in the onewire.spin file in the object exchange. Thanks again.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-26 22:43
    The onewire.spin file is a lower level than "match_rom". Look at the Demo programs packaged together with it. They define the operation codes. You'd need to add a definition for match_rom, use writeByte to send that. You have to compute a CRC with crc8 and use that with the 48 bit address and family code to make a 64 bit address that you send with writeAddress.
  • jyoungjyoung Posts: 16
    edited 2006-12-26 23:17
    I tried that and I got it to work. This is my first attempt at programming with spin and I have never worked with 1-wire devices before this. All in all with your help I am pleaseantly surprised at how simple the propeller is use. Thanks again.
  • T ChapT Chap Posts: 4,223
    edited 2006-12-26 23:19
    Mike are you saying you have to have the device info prior to communication? Is there no means to get it from the Propeller? I tried all those demos using a DS2760 and never got anything to work. I just ordered it's new version, DS2762BE+ and the newer version of the 1620 called the DS1626S+ to test. I have the demo board for the Bs2p40, maybe I can try it like you said and read the numbers first from the Stamp.
  • jyoungjyoung Posts: 16
    edited 2006-12-27 00:03
    you can communicate without an address if there is only 1 device present. I used the OW-searchdemo.spin to identify the device info. I tried looking on the device, there was a number but I can't find a correlation between that number and the address.
  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-27 00:06
    There are two situations.· One is where you have several of the same parts and they're installed at specific physical locations and/or have specific functions.· There you have to know which part is which and the device address alone doesn't tell you what the part does.· In this case, you need to know the address ahead of time and configure your software accordingly.· Then second situation is where you have maybe one of each class of device, certainly not two of a specific class and you want to find out their addresses to control them.· This is where you do a search of the 1-wire bus and build a table at initialization time of which devices are there.· You might have one temperature sensor and one dual addressable switch and maybe one configuation EEPROM and you'd identify which was which and save their addresses in an appropriate table.
    ·
Sign In or Register to comment.