Pa 4
Pa 4
Compare mode, consider 2 timers and 2 signals are given to both, we will compare the signals
of timers, so if both signals match is found after comparing so a particular event is detected.
Capture mode, We will give reference signal to one of the PIN, so that event is capture and
called as capture mode.
We will be using TIMER0, TIMER1 and TIMER3
So for Comparing we will be using TIMER1 or TIMER3
For Capture we will be using TIMER1 or TIMER3
For PWM i.e PWM Waveform generation we will be using TIMER2.
For CCP Mode we will be using 3 Registers
1. CCP1CON Reg of 8 Bit
2. CCPR1High: CCPR1Low of 16bit register
3. Duty Cycle Register of 10 Bit for PWM
CCP1CON Register means CCPWM1Control Register
The all 8 bit registers are used for CCP working
First 2 MSB bits are reserved for future use.
Next 2 bits are DUTY CYCLE Bits named as DC1B1 and DC1B0 Bits which consist of 2 bits
out of 10 bits and remaining 8 bits are taken from CCPR1Low.
i.e DC1B1 and DC1B0 = 2 Bits
CCPR1Low = 8 Bits i.e 2 + 8 = 10 Bits
CCP1M3 to CCP1M0 are compare, capture and Pulse width Modulation
They are 4 bits so 16 Bit combination will form.
e.g 0100 = Capture Mode and down arrow indicate for falling edge.
0101= Capture Mode and up arrow indicate for rising edge.
0110= Capture Mode for 4th rising edge.
0111= Capture Mode for 16th rising edge.
1000= Compare Mode i.e (CCPIF Bit will be 1) i.e CCP pin high.
i.e after comparison the bit will be set to HIGH
1001= It is exactly opposite to bit 1000
i.e CCPIF Bit will be 0 i.e CCP pin low.
i.e after comparison the bit will be set to LOW
1010= Compare Mode CCP Pin NOT affected
1011= Compare Mode Resets timer and starts ADC
11XX= They are used for PWM Mode.
The values are compared from Timer1 and Timer3 Registers i.e TMR1 and TMR3
Timer1 is divided into Timer 1 High and Timer 1 Low. i.e 8 + 8 = 16 Bits.
Timer3 is divided into Timer 3 High and Timer 3 Low. i.e 8 + 8 = 16 Bits.
CCPR1H of 8 Bits and CCPR1L of 8 Bits i.e both 16 Bits are continuously compared with
TMR1 or TMR3 with the help of Comparator.
When any match is found then CCP1IF Flag is Triggered.
The steps to execute the program is as follows:
The important point in Capture mode is as we are using CCP1 PIN as I/P Pin. So when it is set
as I/P Pin then the event is CAPTURED.
In Compare mode CCP1 PIN was used O/P Pin.
When an event is detected in TMR1 or TMR3 Register, then it will be captured in CCPR1H
and CCPR1L 16 bit register.
The events can be captured by Rising Edge, Falling Edge, 4th Rising Edge or by 16th Rising
Edge.
The steps to execute the program in Capture mode is as:
GPIB: General Purpose Interface Bus HDLC (High-Level Data Link Control)
PCI (Peripheral Component Interconnect)
ISA (Industry Standard Architecture)
Write short note on I2C bus protocol
STEP-1
STEP-4
EXAMPLE:
ss
Subject Teacher
Prof Pravin S.Patil