PDA

View Full Version : Pwm



Md.Shah
- 9th October 2006, 08:16
what is the code to get 2 PWM output for PIC16F877A. The second output is inverted from the first output.

mat janssen
- 9th October 2006, 08:40
You could look into the pbp book at HPWM.
And then invert the hpwm output to another pin.
The invert command is also in the pbp book.

mister_e
- 9th October 2006, 15:52
Or use a PIC who provide this with a special register setup. ECCP module comes much popular now.

PIC16F684 could be a smart choice.

Chris Barron
- 28th December 2006, 17:22
Sorry if this has appeared before....I'm trying to use the HPWM command on a 16F690, in half-bridge mode.
The relevant bits to set that mode from the standard mode are in the CCP1CON register.

If I only use the HPWM command the default mode is standard single output PWM
If I insert a line immediately after the HPW comand to set the relevant CCP1CON bits for half bridge then everything works fine.

The problem is that I am looking to make something which could eventually become safety critical and at all times the second PWM output must oppose the first, as it does for proper half bridge operation.

The trouble is that having to add a line to set CCP1CON bits means that the PWM mode works 'properly' in single output mode for a small period of time before I can add the extra CCP1CON instruction.

WHat I would like to know is if there is a simple way to rename the command macro file, change the setting of the CCP1CON bits in that command macro to do what I want and then recompile it, whcih is something I have had difficulty doing in the past.

Chris