Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:10 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : TEMPR=542’C....

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 08:12am 07 Feb 2019
Copy link to clipboard 
Print this post

This one is another one I can't work out.

An 18B20 sensor stuck onto a heater plate, 50% of the time, the result returned is correct - about 37'C. The other 50% of the time, the result is ALWAYS 542'C.

I know that cannot be correct, as I doubt I would be alive at 542'C....

Can anyone suggest why that should be?

Relevant code is:

  Quote   Text 220,225,"PLATE="+STR$(CINT(TEMPR(PLATE)))+" ",L,1,1,RGB(Green)


Smoke makes things work. When the smoke gets out, it stops!
 
JohnL
Senior Member

Joined: 10/01/2014
Location: Seychelles
Posts: 128
Posted: 09:16am 07 Feb 2019
Copy link to clipboard 
Print this post

DeletedEdited by JohnL 2019-02-08
 
Solar Mike
Guru

Joined: 08/02/2015
Location: New Zealand
Posts: 1163
Posted: 09:41am 07 Feb 2019
Copy link to clipboard 
Print this post

Hi Grogster, put your scope between 0v and the data line, at the sensor; you may have noise on the wire stuffing up the readings. I had one of these play up awhile ago whenever a 230 vac fan turned on, ended up being induced mains noise, fixed with ferrite chokes.

Cheers
Mike
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 08:04pm 07 Feb 2019
Copy link to clipboard 
Print this post

  Grogster said  The other 50% of the time, the result is ALWAYS 542'C.


I've seen occasional errors on mine when the 5V supply is bad or there's interference. But then again mine are on long strings, one exceeding 30m.

542 is a weird result to get though, as it can't be derived from the binary output of the things.

2^6 is the most significant bit, which would allow a maximum reading on 127°C.

I do have a vague recollection of some firmware issue relating to DS18B20's, but think that may have been on ARMs or something.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 09:47pm 07 Feb 2019
Copy link to clipboard 
Print this post

Cool, thanks for the suggestions.

@ JohnL: Deleted. Now you have made me curious as to what you posted. Do tell.
Smoke makes things work. When the smoke gets out, it stops!
 
GoodToGo!

Senior Member

Joined: 23/04/2017
Location: Australia
Posts: 188
Posted: 01:22am 09 Feb 2019
Copy link to clipboard 
Print this post

I wonder if it's a calculation error?

542 is 0000 0010 0001 1110 in binary.
According to the datasheet, a valid DS18B20 12 bit reading of that binary number equates to 33.875 degrees.

Food for thought?

Cheers!

GTG!
...... Don't worry mate, it'll be GoodToGo!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 01:57am 09 Feb 2019
Copy link to clipboard 
Print this post

Definitely food for thought but I can't see how it's happening.

The relevant bit of code in the firmware (V5.3) is
fret = (float)((short)(((unsigned short)b2 << 8) | (unsigned short)b1)) / 16.0;


Something in the timing that causes a shift of 4 bits to the left?

Jim



VK7JH
MMedit
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025