ECCP module as CCP module

Thread Starter

mailus

Joined Jun 16, 2012
19
i am working on a project using pic16f1936.
this chip has 5 capture/compare/pwm module.there are 3 ECCP module and 2 CCP module.
i want to use two ccp module on same port (for example two CCP module on PORTC).but in the pic16f1936 chip has different ccp modules are spreaded.
how to use ECCP module as standard CCP module without affecting other ports.

I want to use PWM option.

i am using hi-tech compiler and mplabx.

i attached the pin detail
pic16f1936.png

des.png


How to configure this register
reg.png
 
Last edited:

THE_RB

Joined Feb 11, 2008
5,438
See what the bottom page says re bits7-6.

You can set just one pin as the CCP pin, the other 3 pins become standard port pins.
 

ErnieM

Joined Apr 24, 2011
8,377
See section "23.5 CCP Control Register." If I'm reading the sheet correctly (never a guarantee) PWM mode for ECCP1, 2 or 3 may be set by:

Rich (BB code):
CCPxCON.CCPxM = 0b00    // Single output; PxA modulated; PxB, PxC, PxD assigned as port pins
CCPxCON.DCxB  = 0bxx    // (least two sig bits of duty cycle) (that's your data)
                        // or just set to 0b00 to get an 8 bit PWM
CCPxCON.CCPxM = 0b1100  // PWM mode: PxA modulated, PxC, PxB, PxD unused (see CCPxM)
That's Microchip C notation, check if Hi_Tech does it the same way. And of course, replace "x" with the number of the module you are trying to control.

PIC16(L)F1934/6/7 Data Sheet said:
Throughout this section, generic references to a CCP module in any of its
operating modes may be interpreted as being equally applicable to ECCP1,
ECCP2, ECCP3, CCP4 and CCP5. Register names, module signals, I/O pins,
and bit names may use the generic designator ‘x’ to indicate the use of a
numeral to distinguish a particular module, when required.
You also have a little fine tuning on which pins the CCP2/P2A and the CCP3/P3A outputs use via the alternate Pin Function Control register APFCON. See section 12.1.
 
Top