[Message Prev][Message
Next][Thread Prev][Thread Next][Message
Index][Thread Index]
RE: [OT] Some pic asm code help
- Subject: RE: [OT] Some pic asm code help
- From: "Ian Davidson" <ian@xxxxxxxxxxxxxxxx>
- Date: Sun, 9 Sep 2007 03:11:33 +0100
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
|