• AVR Freaks

Hot!May be CCPRxH value resuts altered when enable and disable PWM mode

Author
OsvaldoH
Starting Member
  • Total Posts : 50
  • Reward points : 0
  • Joined: 2012/11/24 12:49:19
  • Location: 0
  • Status: offline
2020/07/10 20:00:40 (permalink)
0

May be CCPRxH value resuts altered when enable and disable PWM mode

Using PIC16F1825 , TMR6 - PR6= 63    for  8us  period  PWM   internal 32MHz clk
CCP3CON  = 00001100 for standard PWM mode.
I know that CCPR3L is copied to CCPR3H at the end of each PWM cycle
I need sometimes to disable the PWM output and after enable it again
If I do it by clearing CCP3CON, and later seting it again with 00001100, it seems to be that CCPR3H becoms CLEARED.
I can't find information about this matter in the data sheet
Data sheet stated to clear regarding TRIS bit at the end of PWM settings.
Waiting some help
Regards, Osvaldo
#1

2 Replies Related Threads

    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: May be CCPRxH value resuts altered when enable and disable PWM mode 2020/07/10 20:24:36 (permalink)
    0
    OsvaldoH
    If I do it by clearing CCP3CON, and later seting it again with 00001100, it seems to be that CCPR3H becoms CLEARED.

    It is better to state exactly what you observed, rather than just what you think happened.
    i.e. what exactly makes you think that CCPR3H was cleared?
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    OsvaldoH
    Starting Member
    • Total Posts : 50
    • Reward points : 0
    • Joined: 2012/11/24 12:49:19
    • Location: 0
    • Status: offline
    Re: May be CCPRxH value resuts altered when enable and disable PWM mode 2020/07/10 23:20:15 (permalink)
    0
    Improving some amplifier circuit connected to the PWM port, I need to use negated PWM at the port
    I use a negated calculation for the PWM because the pcb was made and I have not seen the CCP3 for PWM was not ECCP and have not the posibility off negated output in CCP3CON
    So I calculated and complement the value before copying to CCPR3L
    With all the care to  have no errors in calculations and setting high the PORTA,2 for the time the PWM be disabled, I have a full output  (PORTA,2 = low) from the moment the PWM is re-enabled  up to the end of current PWM cycle.
    As CCPR3L is always OK at .255 or near level , the only way to have a wrong 0 value in CCPR3H is if some modification arises  inside the pic when clearing or enabling CCPCON for pwm
    I do a provisory (or permanent) patch: setting the TRIS bit before enabling CCP3CON and clearing TRIS bit after PWMcycle end.   With the pull up it works fine
    I can modify program and copy the value of CCPR3H after clearing, also after re-enabling pwm and save both values in EEPROM if there are not available information on the matter.
    It will be usefull if this information be stated in the data sheet.
    I didn´t found it.
    Regards, Osvaldo
     
    #3
    Jump to:
    © 2020 APG vNext Commercial Version 4.5