PDA

View Full Version : Help with 16F684 PWM



Ryan7777
- 4th November 2007, 20:57
I need some help getting PWM to work on a 16F684 to drive 2 motors.
I got DT's HPWM10.pbp to work on PORTC.5 fine, but I've had no luck in getting channel 2 to run.

Works:

for i = 1 to 10
dutycycle1 = dutycycle1 + 101
@ HPWM10 1,_DutyCycle1, _Frequency
pause 80
next i
dutycycle1 = 0

Doesn't work:

dutycycle1 = 0
dutycycle2 = 1023
for i = 1 to 10
dutycycle1 = dutycycle1 + 101
dutycycle2 = dutycycle2 - 101
@ HPWM10 1,_DutyCycle1, _Frequency
@ HPWM10 2,_DutyCycle2, _Frequency
pause 100
next i
for i = 1 to 10

I'm guessing it wont work on the 2nd channel because its not a regular hardware PWM port?
any help would be just dandy!

Ryan7777
- 5th November 2007, 02:20
I should have searched before I asked, sorry!
but does anyone have a routine or thought of writing one that will allow enhanced PWM to work like CCPPWM? I'm not all that great at coding assembly myself...