PICAXE-20X2 OWOut DS18B20

pha555

Senior Member
I have been fooling with a single DS18B20.

With the following code the raw count is correctly displayed if term 3 of the DS18B20 is tied to +5 VDC. This is true for C.0 and B.0. and for the ReadTemp12 and the OWout/OWin technique

However, if I GRD term 3 of the DS18B20 (parasitic power), the raw data using ReadTemp12 is 1360 which is 85 degrees, and this is what I would expect.

But, the OWout technique with strong pullup gives 2047 (all 1s) which baffles me.

Can anyone verify if the strong pullup works with the 20X2.

*************
Code:
#picaxe 20x2

' Converted by X2 Conversion Wizard Version 1.0.2

let dirsB = %11111110
let adcsetup = 0


Top:
  Do
    GoSub MeasTemp1
    SerTxD ("1  ", #w0, CR, LF)
    Pause 2500
    GoSub MeasTemp2
    SerTxD ("2  ", #w0, CR, LF)

  Loop

MeasTemp1:
    ReadTemp12 C.0, w0
    Return

MeasTemp2:    
    OWOut C.0, %1001, ($cc, $44) ' note strong pullup
    Pause 800
    OWOut C.0, %0001, ($cc, $be)
    OWin C.0, %0000, (b0, b1)
    Return
***********************

Thanks.

P H Anderson
 

inglewoodpete

Senior Member
The original discussion (hippy's link, above) was prior to the ow commands that were released on the 28x1 and 40x1. The DS18B20 could not stay standing up during the ReadTemp command when used with a weak pull-up or even a strong pullup.

I haven't tried it but it may be possible to use phantom power with a strong pullup while using the DS18B20 with ow commands and pausing between commands to allow the remote capacitor to recharge. From memory, the datasheet suggested using an independant FET (Ie another PICAXE output pin) to supply the strong pullup in between ow commands.

Peter, can you give us more details on your hardware arrangement?
 

pha555

Senior Member
This is the setup.

Code:
' 20X2            DS18B20
'
'                    +5 VDC
'                    |
'                   4.7K
' C.0 --------- |----- 2 (DQ)  Note that terms 1 and 3 are grounded.
Yes, Dallas does show the external FET. But, I think that documentation was done long ago. Now, every PIC output high is a FET (at least for 10 mA).

When I get back to school I will try to look on a scope. This is the first time I have had an X2 device and I wanted to be sure I wasn't doing something really dumb.

But, for now, I am going to write routines for the DS2438Z (A/D and Temperature), DS2423 (counter) and DS2450 (Quad A/D) using the OWOut and OWIn commands.

Thanks.

Peter H Anderson
 
Top