The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: [OT] Some pic asm code help



Hi Ian

Firstly thanks for your feedback much appreciated...

What i have done is this firstly is test bit 7 of the MSB 0E and if it is
set i compliment each byte and add 1  to each of them...??

I then rotate right the LSB register OF  3 times each time clearing the
carry flag........

I then shift bits 0,1,2 of the MSB into bits 5,6 +7 of the LSB and rotate
the MSB 3 times.........???

With the  result im using existing sub routines that i use to convert the
ds18s20 results into temperature readings....

The results im getting do not tally up with readings im getting using
another device (opnode) which also has moisture sensors attached to
it.........

The moisture sensors use an external resistor so the range should go from
+64mV  to -64mV

Thanks again
Frank


----- Original Message -----
From: "Ian Davidson" <ian@xxxxxxx>
To: <ukha_d@xxxxxxx>
Sent: Sunday, September 09, 2007 12:11 PM
Subject: RE: [ukha_d] [OT] Some pic asm code help


> Hi Frank
>
> I've not used that ic before but looking at the data sheet it works
like
> this.
>
> The value you read from the ic will be a word value. It is left
> justified so you need to rotate the value right three times to get the
> LSB into the bit 0 position.
>
> Say you read
> 00000000 01010000
>
> By rotating it 3 times it will become
> 00000000 00001010
>
> Now you need to test bit 12, in the example it is a zero which means
the
> number is a positive number. You can therefore just use that number in
> this case decimal 10. If you are using the internal resistor then the
> resolution is 0.625mA. 10 x 0.625mA is 6.25mA which is the current the
> device is seeing.
>
> Now if bit 12 was a 1
>
> I.e.
> 00011111 11110110
> Then that is a negative number. In two complement you need to invert
all
> the bits and add one for all the bits below bit 12 so
>
> 00000000 00001001
>
> Add 1
>
> 00000000 00001010
>
> Which is 10 decimal times by 0.625mA equals -6.25mA
>
> I hope that made sense Frank.
>
> Ian D
>
>
> -----Original Message-----
> From: ukha_d@xxxxxxx [mailto:ukha_d@xxxxxxx] On Behalf
> Of Frank Mc Alinden
> Sent: 08 September 2007 23:45
> To: Ian
> Subject: [ukha_d] [OT] Some pic asm code help
>
> Hi Guys
>
> Sorry for the OT post but im hoping some of the pic coders can help
> me....Im
> trying to add support for the Hobby Boards moisture sensor to my Probe
> system and im stuck trying to write some code to convert the readings
> from
> the "current registers (OE +OF) " of the DS2760...(The
mositure sensor
> uses
> the current sense) ...I can read the DS2760 and get the values i just
> cant
> work out how to convert it to mVolts.......Any help much
> appreciated......If
> i get this sorted i will then have a crack at their Humidity
> sensor.......
> Heres a link to the hobby boards sensor and the DS2760 PDF
> http://datasheets.maxim-ic.com/en/ds/DS2760.pdf
>
> http://www.hobby-boards.com/catalog/product_info.php?cPath=22&products_i
> d=70
>
> Thanks
> Frank
> www.armaghelectrical.com.au
>
>
>
>
>
>
>
>
>
>
>
>
>
>



UKHA_D Main Index | UKHA_D Thread Index | UKHA_D Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.