PDA

View Full Version : HPWM and timer 1 on pic16f77



n qwerty
- 16th April 2008, 19:42
im using a pic16f77 and am using the ccp in pwm to generate a 1khz square wave by the following

DEFINE CCP1_REG PORTC
DEFINE CCP1_BIT 2

HPWM 1,127,1000

this works fine until the main program starts (which uses the timer1 module for a counter) when the frequency changes to around 8Khz and i have no idea. Is there some port i need to set to keep it in hpwm mode or am is there something else going on

thanks

mister_e
- 16th April 2008, 19:48
Probably you did something bad somewhere, this PIC use TIMER 2 for HPWM.

Post your whole code here.. unless we can't help.

n qwerty
- 17th April 2008, 12:30
seem to have sorted it. appears something to do with PIR and PIE registers. commented it out and works as before but without the frequency changing