Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Bit of PWM/comparator help pls

Status
Not open for further replies.

Mosaic

Well-Known Member
Hi All:
Regarding the 16f886 @ 8Mhz.

I have an analog event that triggers comparator #2 every 8mS. This triggers an interrupt and must output a Port pin pulse with a 0 uSec (no pulse) to a 200uSec range pulse width.

What is the best approach to handle that process?

I also have another process that requires hardware PWM. Can the 16f886 deliver more than 1 independent PWM signal? The spec. sheet is a bit confusing with the full & half bridge comments.

Thanks.
 
It may be doable but will require some tricky programming. The first signal would have to be software and the second hardware or vice versa as you don't explain what defines the first signals duration/resolution or the second signals, well, anything.

Tell us the full story and we may be able to help.

Mike.
 
The 16F886 can deliver 2 independent PWM signals when running standard PWM. These signals are present on P1A/CCP1 and CCP2.

When running Enhanced PWM it can generate 4 signals on P1A, P1B, P1C and P1D that are timed specifically for driving an H-bridge on CCP1.

Enhanced PWM is only available on CCP1. Writing 00001100 (0x0C) to both CCP1CON and CCP2CON sets up CCP1 and CCP2 as two independent standard PWM modules. CCP2CON can ONLY be set up for standard PWM. When configured for standard PWM, P1B, P1C and P1D function as standard port I/O pins on port B.

When using standard PWM, no need to worry about the full/half bridge settings.
 
Last edited:
A note of clarification: even though the 16f886 sports two PWM outputs; the outputs must have the same period (frequency), though they can have different duty cycles.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top