ECCP module as CCP module

Discussion in 'Embedded Systems and Microcontrollers' started by mailus, Sep 8, 2013.

  1. mailus

    Thread Starter New Member

    Jun 16, 2012
    19
    0
    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: Sep 8, 2013
  2. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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.
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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:

    Code ( (Unknown Language)):
    1. CCPxCON.CCPxM = 0b00    // Single output; PxA modulated; PxB, PxC, PxD assigned as port pins
    2. CCPxCON.DCxB  = 0bxx    // (least two sig bits of duty cycle) (that's your data)
    3.                         // or just set to 0b00 to get an 8 bit PWM
    4. 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.

    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.
     
Loading...