On Sun, May 16, 2010 at 9:10 AM, Joep Suijs <[email protected]> wrote:

> Hi Vasile,
>
> I never used this device, but it looks like you have to know the rom
> code of each device in advance or issue the - quite complicated -
> search rom procedure.
>

This one is not complicated:

var byte d1=0 , d2=0, d3=0, d4=0, d5=0, d6=0, d7=0, d8=0
var byte error = 3
procedure store_DS_id (byte in eeprom_address) is

error =_1w_reset
_1w_writebyte(0x33)

  d1 = _1w_readbyte
  d2 = _1w_readbyte
  d3 = _1w_readbyte
  d4 = _1w_readbyte
  d5 = _1w_readbyte
  d6 = _1w_readbyte
  d7 = _1w_readbyte
  d8 = _1w_readbyte

  data_eeprom_write ( eeprom_address,     d1 )
  data_eeprom_write ( eeprom_address + 1, d2 )
  data_eeprom_write ( eeprom_address + 2, d3 )
  data_eeprom_write ( eeprom_address + 3, d4 )
  data_eeprom_write ( eeprom_address + 4, d5 )
  data_eeprom_write ( eeprom_address + 5, d6 )
  data_eeprom_write ( eeprom_address + 6, d7 )
  data_eeprom_write ( eeprom_address + 7, d8 )

end procedure
-------------------------------------------------------------------------------

procedure match_rom( byte in sensor ) is ; address unique sensor on the bus
   _1w_reset
   _1w_writebyte( 0x55 )  ; match rom

  if sensor == 0 then
    read_DS_id ( 10 )
  elsif sensor == 1 then
    read_DS_id ( 18 )
  elsif sensor == 2 then
    read_DS_id ( 26 )
  elsif sensor == 3 then
    read_DS_id ( 34 )
  end if

   _1w_writebyte( d1 )  ; send matched id
   _1w_writebyte( d2 )
   _1w_writebyte( d3 )
   _1w_writebyte( d4 )
   _1w_writebyte( d5 )
   _1w_writebyte( d6 )
   _1w_writebyte( d7 )
   _1w_writebyte( d8 )

end procedure



> You mention '9 software predefined sensors'. Which software is that?
>

A part of it it's exemplified above, only for 4 sensors and only for reading
the ID and ROM matching . However it's not written in jallib standard...so
the library pack will need to wait.

The part I need is described here, and looks for me feasible for jal
implementation:
http://www.maxim-ic.com/app-notes/index.mvp/id/187


Vasile


> Joep
>
> 2010/5/16 vasile surducan <[email protected]>:
> > Still have a problem... :(
> > Maybe you know DS18B20. I'm reading the 8 byte ID (64 bit code) of every
> > sensor used on the bus (one by one inserting it manually into the
> socket).
> > Then I'm inserting all sensors on the bus and reading the temperature of
> the
> > matched sensor. So far so good, everything works OK on a bus of 100m
> lenght.
> > Since I can use less than 9 sensors on the bus (from the 9 software
> > predefined), say only 3, I'm performing the ID match only for 3 sensors.
> If
> > I read the other 6 sensors left (which ID does not match) the value I got
> is
> > 31.9 (in terms of celsius temperature).
> > With one sensor connected on the bus I've managed this by reading the
> sensor
> > presence bit. If there is  no sensor on the bus, I display a message
> "OPEN".
> > However, with more than one sensor on the bus I never got this message,
> > because always there is at least one sensor on the bus, even with other
> ID
> > than expected.
> >  I don't know yet how to solve this. I need to display somehow if there
> is
> > an empty socket to a corresponding sensor name. There is a too complex
> > algorithm for this operation called search ROM, which I don't want to use
> > it...
> > Example: s1: 22.5
> >                s2: 37.5
> >                s3: 60.0
> >                s4: OPEN
> >                s5: OPEN
> >                s6: OPEN
> >                etc
> >
> > On Sun, May 16, 2010 at 4:09 AM, Joep Suijs <[email protected]> wrote:
> >>
> >> :) JAL & Sustainability!
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "jallib" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected]<jallib%[email protected]>
> .
> >> For more options, visit this group at
> >> http://groups.google.com/group/jallib?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "jallib" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<jallib%[email protected]>
> .
> > For more options, visit this group at
> > http://groups.google.com/group/jallib?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<jallib%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to