Jonathan
03-18-2009, 10:13 PM
Hi All,
I am having trouble getting the PWMx8 object to work on pin 13. It seems to have something to do with which pin I am trying to use. If I set the base_pin to 0, I can get PWM out of any pin 0-7. However, if I try to set the based_pin to 8 and get PWM out of 8-15, no joy. Here is the snip. It works fine 0-7, but nothing out of 8-15. The pins are all fine, I can manually twiddle them. The snip below should PWM all of the pins in the bank. For just pin 13 the pin select byte would be %0010_0000
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
base_pin = 8
VAR
byte duty
OBJ
pwm : "PWMx8"
PUB init
freq := 300
duty := 128
pwm.start(base_pin, %1111_1111,freq)
pwm.duty(base_pin,duty)
repeat
Any ideas what I am doing wrong?
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info (http://www.madlabs.info) - Home of the Hydrogen Fuel Cell Robot
I am having trouble getting the PWMx8 object to work on pin 13. It seems to have something to do with which pin I am trying to use. If I set the base_pin to 0, I can get PWM out of any pin 0-7. However, if I try to set the based_pin to 8 and get PWM out of 8-15, no joy. Here is the snip. It works fine 0-7, but nothing out of 8-15. The pins are all fine, I can manually twiddle them. The snip below should PWM all of the pins in the bank. For just pin 13 the pin select byte would be %0010_0000
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
base_pin = 8
VAR
byte duty
OBJ
pwm : "PWMx8"
PUB init
freq := 300
duty := 128
pwm.start(base_pin, %1111_1111,freq)
pwm.duty(base_pin,duty)
repeat
Any ideas what I am doing wrong?
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info (http://www.madlabs.info) - Home of the Hydrogen Fuel Cell Robot