PDA

View Full Version : 16F690 HWPM - outputting PWM on a different HPWM port/pin - brainache!



HankMcSpank
- 14th July 2010, 18:10
Now I'm sure this ought to be simple, but I'm getting unfeasibly confsued wrt register settings on the 16F690 ECCP module.

Firstly I've got HPWM working with my 16F690 (& got the right PICBasic command too!).

This seem to do the job...



CCP1CON = %00001100 'Select PWM Mode
CCPR1L = 0
PR2 = 255


HPWM 1,350,20000


The thing is, because of easier (intended) PCB track layout, I'd much rather the HPWM came out of Pin 7 (vs the default pin 5 from that code above), my problem is associated with the CCP1CONN register explanation on p129 of the datasheet...

http://ww1.microchip.com/downloads/en/DeviceDoc/41262E.pdf

...it's not clear to me how to actually select P1C (PIN 7) as the pin for the HPWM stream to output on - Is it even possible to have the PWM stream come out of P1C in single output?

Any help greatfully received!

mackrackit
- 15th July 2010, 04:27
One of the problems with using hardware is you can not change things around.
For a single PWM output you are stuck with P1A being modulated.
Maybe you could set it up as a half or full bridge and not use P1a but I do not know what problems that will cause.

I will bet a jumper on the PCB will be easier to deal with ;)

Charles Linquis
- 15th July 2010, 05:14
If you don't really need 20Khz, you might be able to use -

http://www.pbpgroup.com/modules/wfsection/article.php?articleid=6

HankMcSpank
- 15th July 2010, 10:30
Thanks guys ...hey ho, looks like I'm stuck with Pin 5 then - sheesh, hardware schmardware (I do need 20Khz - but that a useful 'solution' to tuck away though)

BrianT
- 23rd July 2010, 08:39
You show a command HPWM 1,350,20000 which implies you have 9 or 10 bit HPWM.

Is the 350 a typo or have you got something special in your HPWM command?

Cheers
Brian

HankMcSpank
- 24th July 2010, 09:34
You show a command HPWM 1,350,20000 which implies you have 9 or 10 bit HPWM.

Is the 350 a typo or have you got something special in your HPWM command?

Cheers
Brian

Hi Brian,

Good spot - it was a typo - I didn't cut/paste from my program buy I just hastily typed it in to the post. (as it goes, I use 10 bit PWM, which might account for me getting carried away with the numbers for the duty cycle!)