I've been struggling with getting reliable readings from my DS18B20 sensors when I also have hpwm code.
I am running a variable speed pump based on temperature readings. I see from the manuals that the readtemp12 commands can interact with hpwm due to internal frequency changes and the manual suggested turning off pwm when doing readtemp commands. This isn't good and the pulsing pump isn't what I need.
I'm using the 20X2 chip on the AXE118 PICAXE-20 Project Board and I've tried adding some more capacitors as the Board has only one small capacitor .
I use this code
setfreq m4
hpwm pwmsingle, pwmHHHH, %1000, 249, w2
The setfreq m4 is an attempt to match the hpwm frequency with the 4MHz that readtemp uses.
The temperature readings are stable and correct when the pump is fully on or off, but at some intermediate duty values the temperature reading occasionally come in rogue - zero's or weird values. At a good intermediate duty maybe 1 in 1000 are rogue, while at bad points its been 1 in 2 or so.
I've tried changing the period and it changes the behaviour without solving the problem - i.e different duty settings give the problem.
It was all working fine with pwmout on a 18M2 chip and the CHI035 PICAXE-18 High Power Project Board, but I needed more memory for the program. For the output from the pin to the pump, I've reproduced the FET, diode, resistors, capacitor etc from the PICAXE-18 High Power Project Board on my new set up.
I am running a variable speed pump based on temperature readings. I see from the manuals that the readtemp12 commands can interact with hpwm due to internal frequency changes and the manual suggested turning off pwm when doing readtemp commands. This isn't good and the pulsing pump isn't what I need.
I'm using the 20X2 chip on the AXE118 PICAXE-20 Project Board and I've tried adding some more capacitors as the Board has only one small capacitor .
I use this code
setfreq m4
hpwm pwmsingle, pwmHHHH, %1000, 249, w2
The setfreq m4 is an attempt to match the hpwm frequency with the 4MHz that readtemp uses.
The temperature readings are stable and correct when the pump is fully on or off, but at some intermediate duty values the temperature reading occasionally come in rogue - zero's or weird values. At a good intermediate duty maybe 1 in 1000 are rogue, while at bad points its been 1 in 2 or so.
I've tried changing the period and it changes the behaviour without solving the problem - i.e different duty settings give the problem.
It was all working fine with pwmout on a 18M2 chip and the CHI035 PICAXE-18 High Power Project Board, but I needed more memory for the program. For the output from the pin to the pump, I've reproduced the FET, diode, resistors, capacitor etc from the PICAXE-18 High Power Project Board on my new set up.