Friday, December 12, 2008

CCP Module in PIC16F877A -- Tutorial

<--Previous Tutorial Next Tutorial--->

In this post I will cover about the PWM module present in the pic microcontroller .I will cover it using PIC16F877A but it can be applied to any pic with a CCP module .

What's CCP module ?

CCP-- Capture Compare Pulse Width Module

Capture - The contents of the 16 bit timer,upon detecting an n th rising or falling edge, is
written to internal registers .
Compare - Generate an interrupt, or change on output pin, when Timer 1 matches a pre-set
comparison value .
PWM - Create a re-configurable steady duty cycle square wave output at a user set frequency.

For more information see this MicroChip pdf .

For now I am not going to cover the capture and compare modules .Lets see about the pwm module . You have 2 channels in PIC16F877A to accomplish the task .
Its present in pins

16 --- RC1 ---- CCP2
17 --- RC2 ---- CCP1
As you notice there are two channels present in the pic .This is ideal for robots with two wheel differential drive .You can achieve smooth turns acceleration if you use these two pins intelligently .Now let us see how to program the pwm using mikroc in the next tutorial .

<--Previous Tutorial Next Tutorial--->

No comments: