DS1820

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

DS1820

Post 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
Attachments
1. Single OneWire_DS18B20_ 16f886.fcf
(11.97 KiB) Downloaded 293 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: DS1820

Post by Benj »

Hello Jorgen,

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

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: DS1820

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: DS1820

Post 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

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: DS1820

Post 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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times

Re: DS1820

Post 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

Post Reply