Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 16:17 02 May 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 and the CGCOLORMAX

Author Message
jincamty

Newbie

Joined: 10/07/2011
Location: New Zealand
Posts: 21
Posted: 02:29pm 15 Apr 2017
Copy link to clipboard 
Print this post

Hi Guys,
Long time lurker and revisiting an old display project using the CGCOLORMAX2
and a VGA lcd.

Can someone please give me a code example to use two or more DS18B20 sensors.
They can use separate pins.
I am getting confused with different commands.
I think I'm using ver 4.5 (but don't know how to find out)

DS18B20()
TEMPR

Is it a matter of connecting them to an analog input and doing some maths
or is there more to it?

Also is there somewhere where I can find really basic code examples as building
blocks?
I have googled my fingers off and can only find arduino related stuff.

Cheers Cameron Carter
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5909
Posted: 02:54pm 15 Apr 2017
Copy link to clipboard 
Print this post

PRINT MM.VER
will give you the version number
Being a CGCOLORMAX2 it is very likely V4.5

To read the DS18B20, page 10 of the V4.5 manual has examples.
You have to remember to refer to the manual for your version of MMBasic. There have been afew changes that will jump up and bite you if you try and use the wrong version of the commands. (The maximite will be unharmed by the experience)

Have you seen the MMBasic Library.
http://geoffg.net/Downloads/Maximite/MMBasic%20Library.zip

It has a lot of older programs that are suitable for the Maximites.

Jim
VK7JH
MMedit   MMBasic Help
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 06:53pm 15 Apr 2017
Copy link to clipboard 
Print this post

  jincamty said  Is it a matter of connecting them to an analog input and doing some maths
or is there more to it?

Also is there somewhere where I can find really basic code examples as building
blocks?
I have googled my fingers off and can only find arduino related stuff.

Cheers Cameron Carter


Hi there.
Welcome aboard.

First, you need to decide if you want your 18B20 sensors to be powered externally or via parasitic power. External power is an external 3v3 power, parasitic power is when the 18B20 sensor bleeds off the power it needs to operate, from the I/O pin it is connected to.

Assuming either one(see standard manual, page 25), all you have to do, is issue the command - simple as that - no conversion to do or any maths at all. The figure returned will be the temperature in degrees Celsius.

So, for example:

PRINT "Temperature is: " TEMPR(3)

...will request the temperature from an 18B20 sensor connected to pin-3.

This takes about 200mS to return, but it should come back with a figure on the console, representing the temperature in 'C.

TEMPR START is a command used to start reading the temperature in the background, but this only currently works on ONE sensor at a time, so you can't TEMPR START another sensor, till the first one has been read.

Again, see page 25 of the current standard manual.

Good luck, and do post back if you have any problems.
Everyone here is friendly.

As to simple programming examples, I think that your best bet would be the Silicon Chip articles on programming the Micromite. They are written for the lamen/laywomen, and are a good starting point. These were published in Silicon Chip magazine in Febuary, March and April 2017 issues.
Smoke makes things work. When the smoke gets out, it stops!
 
jincamty

Newbie

Joined: 10/07/2011
Location: New Zealand
Posts: 21
Posted: 08:50pm 15 Apr 2017
Copy link to clipboard 
Print this post

Hi, Thanks Jim and Grogster.

I managed to get it working toady.
The version I had was ver 4.0. I managed to upgrade to Ver 4.5 but when I type
Print MM.Ver it shows 4.05. Is that correct?

The TEMPR( ) doesn't seem to exist in Ver 4.05

Print "Water " DS18B20(15) seems to work.

The sensors I am using are three wire sealed units (red,white,black)
I assumed Red=5v, Black=ground, White=out, (I/O pin 15)
Nothing happened until I connected a 4k7 resistor between +5v and out.(Pin 15).

Silicon chip magazine was what got me into this stuff, starting with the Picaxe chips.

Cheers Cam.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 09:20pm 15 Apr 2017
Copy link to clipboard 
Print this post

Yes indeed, SC and the PICAXE series of articles, was where it started with me too!
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


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

© JAQ Software 2024