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.
Chrisk Senior Member Joined: 21/12/2014 Location: AustraliaPosts: 137
Posted: 11:56pm 31 Aug 2018
Copy link to clipboard
Print this post
Hi Guys I don't know what I am missing here, it's obviously about pin allocation but I cannot see it. I have two DS18B20 connected to pins 15 and 16. I wanted to add a third to pin 9
Pins 15 and 16 work fine but I get an error when I use pin 9.
The test program is below. ' DS18B20 test program for maximite insitu - tmptest2.bas ' 31/1/2018 ' Clear 'clear any variables in memory ' Initalise I/O pins Temppin = 9 ' DS18B20 pin Setpin Temppin,2 ' Make it input digital Probe = DS18B20(9) N = 0 TT2 = 0 Do TT1 = 0 N=N+1 TT1 = TT1 + Probe Pause 100 If TT1 < 0 then TTout = (-128 + 1) - Probe TT2 = TT2 + TTout else TT2 = TT2 + probe endif Loop until N > 10 Pause 50 TT2 = TT2/N Print TT2 End
Running it gives the following error:
[16] Probe = DS18B20(9) Error: DS18B20 not responding
What am I missing? I've checked the wiring and used two DS1820s. Is it a problem with pin allocation?
Chris K
Chopperp Guru Joined: 03/01/2018 Location: AustraliaPosts: 1106
Posted: 08:01am 01 Sep 2018
Copy link to clipboard
Print this post
Hi Chrisk,
I assume you are using physical pin 43 (pin 5 on con6) for DS18B20(9).
BTW, you do not have to initialise the pins or do anything else. It is done for you.
One of my lines of code is simply:- Read_Temp = ds18b20(5) where (5) is physical pin 24 (pin 13 on con6).
I have used many other pins but not tried pin(9) but it should work assuming it is wired correctly with the specified load resistor.
BrianChopperP
Chrisk Senior Member Joined: 21/12/2014 Location: AustraliaPosts: 137
Posted: 10:21am 01 Sep 2018
Copy link to clipboard
Print this post
Hi Brian/Chopperp
The pin 9 that I am using is the MMBasic pin 9 which should be correct. The other two DS18B20s are using MMBasic pins 15 and 16 as described on p6 of the Maximite Hardware Manual under the heading "Rear Panel I/O Connector" which has 26 pins.
Didn't realize I didn't need to initialize pin when used in conjunction with DS18B20.
Chrisk
Chopperp Guru Joined: 03/01/2018 Location: AustraliaPosts: 1106
Posted: 11:16am 01 Sep 2018
Copy link to clipboard
Print this post
Hi Chrisk,
OK. There's a lot to learn (& forget) . I assume you have looked at page 10 of the MMBasic Language Manual Ver 4.5.
If your are using MMEdit in MM Chat mode (or with the screen editor I think), you should be able to check the sensor operating by typing:-
Probe = DS18B20(9) <Enter> print Probe <Enter>
or just Print DS18B20(9) should work.
It should give the current temp reading if it is working.
Use this method with one of the working ones first to make sure you can get readings.
You say you have swapped sensors around?
Are you able to temporarily use another pin? I also use some on the Arduino connector. (D11, 12 & 13)
I have actually used pin(9) in the past, so it should work.
BrianChopperP
Chrisk Senior Member Joined: 21/12/2014 Location: AustraliaPosts: 137
Posted: 03:03am 03 Sep 2018
Copy link to clipboard
Print this post
Thanks for the tips Brian Helped me solve the problem.
I had these probes on a 3m cable with 3 wires, yellow, red and black. I had joined the red and yellow and used the black as the 0V. That was a mistake. Should have joined the red and black for 0V and yellow for the data. Had I not used heat shrink over the joins of the other two I would have noticed. I shouldn't have assumed connections for operation in parasitic mode.
Thanks for your responses. Chris K
Chopperp Guru Joined: 03/01/2018 Location: AustraliaPosts: 1106