What am I doing wrong with hpwmout?

Pongo

Senior Member
I've been tearing my hair out trying to catch an elusive bug in a large 20x2 program. Seems like I have a misunderstanding of single mode hpwm. The issue is that "something" is taking C.2 low after it has been set high. Chipping away at the code I've reduced it to this snippet that demonstrates the problem.

Unless the hpwmout line is commented out, C.2 goes low when the readtemp12 C.4 happens. I thought a setting of %0001 would leave all pwm pins except A (C.5) unaffected. I've been using this code a long time but now need to add an LED on C.2 and came across this issue.

To add to the mystery if there is no DS18B20 connected to C.4, C.2 stays high.

Code:
#picaxe 20x2
#Terminal 9600
#No_Table
#No_Data
Symbol Heat = w8
w8 = 0
hpwmout pwmdiv4,0,0,%0001,207,Heat ' setup for the pwm output (drives FET) 
High C.2
Main: 
readtemp12 C.4,w1
SerTxd (#w1)
SerTxd( CR, LF )
Pause 500
goto main
 

hippy

Technical Support
Staff member
It could be the HPWMOUT or the READTEMP12 causing the issue; hard to tell for the description of things.

There was an issue with some commands affecting different pins on some early versions of the firmware though this doesn't seem to match the description of that issue. What version of firmware does your chip have ?
 

Pongo

Senior Member
Firmware vC.3 - I tried another 20x2 but it's from the same order with same manufacturing code.
 
Top