Help with I2C DS1621
David E.
Posts: 13
I'm just getting started with the Prop, have been trying some things out, and I am trying to get a DS1621 to work over I2C.
I have it working using the i2cobject demo from the OBEX, and displaying the temperature on a TV screen. No big deal.
However, any of my attempts to actual get the .5 degree resolution have failed. I am only able to get temperature down to 1 degree, even though the device is sending out 9 bits of data. Are return values for objects/methods not allowed to be anything other than integers? I was not able to find clarification in the manual, it says nothing about limitations on the return value.
I have it working using the i2cobject demo from the OBEX, and displaying the temperature on a TV screen. No big deal.
However, any of my attempts to actual get the .5 degree resolution have failed. I am only able to get temperature down to 1 degree, even though the device is sending out 9 bits of data. Are return values for objects/methods not allowed to be anything other than integers? I was not able to find clarification in the manual, it says nothing about limitations on the return value.
Comments
You can use the floating point library and convert the 2 byte temperature to floating point or you can represent the temperature as an integer scaled in terms of 1/2 degrees with 1.5 represented as 3 or 11.5 represented as 23, etc.
Post Edited (Mike Green) : 6/12/2008 6:27:05 PM GMT
This is the method in the DS1621 object that calls and reads the 9 bits from I2C to the device. Would I multiply this by 2 before returning from the method or is there some other way I should do this?
Would it be better to multiply by 10 and simply remove the last digit when displaying?
Post Edited (David E.) : 6/12/2008 7:56:11 PM GMT
This is my first forray into uCs and I'm trying to get used to the integer only aspect of things, I'm used to being able to have variables of all types.
I've had it with this thing, I'm going to the gym to work on something that I understand. Maybe when I come back I'll have an epiphany or something.
Post Edited (David E.) : 6/13/2008 4:50:36 AM GMT