Using 20x2 with DS18B20 @ 64 Mhz Question

Hi,

My situation:
I want to use a 20X2 at 64Mhz to control a fan with PWM, depending on the temperature (by reading the DS18B20).
I also want to do some other things, but those are irrelevant.

Does anyone know if it is possible to read the DS18B20 temperature sensor using the 20x2 at 64Mhz (without temporarily reducing the clock to 4Mhz)?

I am aware that Readtemp / Readtemp12 will read the temperature, but those will lower the clock frequency to 4Mhz.

I'm looking at the owin & owout commands. They don't seem to specify that I need to be running at 4Mhz, but they don't say if they will work at 64Mhz either.

The reason I don't want the clock frequency to be reduced is because when using PWM, slowing the clock frequency interferes with the PWM and creates noise from my fans.

Thanks in advance...
 

eclectic

Moderator
From Manual 2, page 155

"Affect of increased clock speed:
This command only functions at 4MHz. X1 and X2 parts automatically use the
internal 4MHz resonator for this command."

e

Ignore what I've said.
I must learn to read! :-(
 
Last edited:

Andrew Cowan

Senior Member
Ec - however, that is for the ReadTemp command - not owin or owout.

Since there is one wire (ie no clock line), I'd imagine that the PICAXE needs to work at a known speed (ie 4MHz) - it is not like a SPI protocol where timing is controlled by a clock line.

Are you able to use a slave PICAXE running a 4MHz with then sends the temperature to the master PICAXE? Alternativly you could use a different digital sensor that is read via ReadADC.

A
 

hippy

Technical Support
Staff member
I'll check operation of OWIN and OWOUT at 64MHz but if they do work it will most likely be by dropping the system clock to 4MHz/8MHz and restoring it to 64Mhz when they complete, it just saves the user from having to explicitly issue SETFREQ commands before and after.

The reason for doing it this way is that it saves a considerable amount of firmware space and does not affect the majority of PICAXE users. The One-wire interface is very specific in its timing and we would have to duplicate firmware routines for all possible frequencies which would mean losing other commands.

The best way to have READTEMP, OWIN and OWOUT with PWM at above 4MHz/8MHz is to use two separate PICAXE so each can run at their own optimal speeds, control data passed by serial.
 

hippy

Technical Support
Staff member
Testing with 20X2 and OWIN / OWOUT works regardless of operating speed and I presume it drops to 4MHz/8MHz operation to do so.
 
Top