Page 1 of 1

DS1820

Posted: Sun Jun 10, 2012 9:25 am
by jgu1
Hi all!

I've been playing this project and it works fine, with very accurate display of the temperature. But when I measure a temperature below zero degrees I get this view: Examble: -5.-18 C and I want it to view -5.18 C

I've tried almost everything but can not get minus line after the comma away. I can see in the calculation it must have something to do with mod. Is there anyone who can help. :D

Best regard

Jorgen

Re: DS1820

Posted: Mon Jun 11, 2012 9:50 am
by Benj
Hello Jorgen,

What happens if you make Temp2 a Unsigned Int in the variable manager? Does this help at all?

Re: DS1820

Posted: Tue Jun 12, 2012 6:22 am
by jgu1
Hi Ben!

Thank´s It work :D . But the decimals after the decimal point shifts between 1 and 2 decimal places. Do you have a proposal for how I either keep it in one or two decimal.

Best regard

Jorgen

Re: DS1820

Posted: Tue Jun 12, 2012 9:30 am
by Benj
Hello Jorgen,

You might be able to do something like this.

LCD Print Number Temp2

Decision Temp2 < 10

Yes: LCD Print Number 0

Re: DS1820

Posted: Tue Jun 12, 2012 11:06 am
by jgu1
Hi Ben!

You're a genius. :D It does certainly seem to work in simulation. Now you will probably wonder how I can simulate oneWire component, but I have put a pot (analog) into my FC and let it vary "Temp". I´ll test it in real life tonight, you will hear. But so far thanks.

Jorgen.

Re: DS1820

Posted: Tue Jun 12, 2012 7:36 pm
by jgu1
Hi Ben!

It work´s with + C. 2digit, but when I get under 0 C I get 3 digit after the comma. It´s ok, but if you have an easy way to remove the third digit It would be nice.

Thank´s in advance

Jorgen