Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:37 17 Jun 2024 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 : DS18B20 Reading Issues

Author Message
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 915
Posted: 02:36pm 21 Jun 2016
Copy link to clipboard 
Print this post

I have a waterproof probe version of the DS18B20 connected to a 170 with MMBasic 5.1
Here is a code snippet:

Do
TRTEMP=DS18B20(2)
Print TRTEMP
WRITE_DISPLAY
Pause 1000
Loop

This is an example of the readings:



Can someone give a reason for the 85 readings?
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2302
Posted: 05:19pm 21 Jun 2016
Copy link to clipboard 
Print this post

what is the line:
WRITE_DISPLAY

supposed to do? if it contains a leftover print statement, that could be the culprit!

try changing the line:
Print TRTEMP

to:
Print TRTEMP; " degrees"

so that you can be 100% sure where the '85' is coming from.


cheers,
rob :-)
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 915
Posted: 07:16pm 21 Jun 2016
Copy link to clipboard 
Print this post

Rob the WRITE-DISPLAY sub outputs the reading to a set of 7 segment displays and the 85 appears there as well.
GM
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8648
Posted: 09:45pm 21 Jun 2016
Copy link to clipboard 
Print this post

Do you have a 4K7 pullup on the DS18B20 data line?
 
VK2MCT
Senior Member

Joined: 30/03/2012
Location: Australia
Posts: 120
Posted: 10:04pm 21 Jun 2016
Copy link to clipboard 
Print this post

How does the WRITE-DISPLAY sub 'get' the number to be displayed ?
John B
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 915
Posted: 10:42pm 21 Jun 2016
Copy link to clipboard 
Print this post

@ Peter yes I do have the 4K7 pullup on the pin.

@ John the code to display the temperature reading on the 7 segment displays is fairly convoluted as I have 2 and 1/2 digits plus two decimal points and it auto ranges from 0-1.99/19.9 and 199. Each led segment is directly driven by a pin on the micromite.
 
VK2MCT
Senior Member

Joined: 30/03/2012
Location: Australia
Posts: 120
Posted: 12:05am 22 Jun 2016
Copy link to clipboard 
Print this post

Sorry about my misleading question.

How does the variable TRTEMP get to be used by the subroutine WRITE_DISPLAY .
Consider posting the first dozen or so lines of the subroutine.

John BEdited by VK2MCT 2016-06-23
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 915
Posted: 01:03am 22 Jun 2016
Copy link to clipboard 
Print this post

Found the problem. The error was caused by the cpu speed not being consistent. As I intended to run the device on batteries I was putting the micromite to sleep and waking it up for some time to present the reading. If I recall I had this issue some time ago and corrected it with cpu speed it is just that this time it presented in a different way giving the 85 reading.
Thanks for your contributions
Graeme
 
Print this page


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

© JAQ Software 2024