Michael,
This short piece of code is what I use on my electric scooter. I've never actually viewed the output on a scope but you can hear the low growl of the pulses. So I'm sure it's not at the normal 4000Hz. minimum and it's only on the PWM pin. So I don't know if that helps?
chopper:
READADC10 1, W0 'read the 0-5vdc throttle voltage and put the value into word W0
PWMOUT 2, 200, W0 'pulse out on pin 2 of the 0-8M chip
POKE $12, $06 'spooky stuff goes on here, see note below
GOTO chopper
Note:
This POKE's the T2CON register (spooky stuff, I don't really know what this register is for, but works here like a pre-scaler)
POKE $12, $05 'provides a pre-scale of 1:4
POKE $12, $06 'provides a pre-scale of 1:16
If the 08-M minimum PWM frequency is about 4000Hz. It can be scaled down to around 1000Hz. or 250Hz. respectively. But on the PWMOUT pin only.
Note: POKE must be after the PWMOUT or it didn't seem to pre-scale at all.
I have seen some code around that I think(?) pulses a digital output with variable pulse width etc. etc. I think all you had to do is feed the variables in the code with the right info and magic…… PWM out!. But then I'm no software engineer, I just tinker around out in my workshop.
"The Addict"
Â