• AVR Freaks

Hot!PWM using CCP4 of PIC16f18857 question

Author
d2willys
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2019/08/08 12:29:18
  • Location: 0
  • Status: offline
2019/08/08 13:29:11 (permalink)
0

PWM using CCP4 of PIC16f18857 question

I seem to have gotten the PWM working out of the CCP4 output pin. But I need to use the signal for an internal counter and cannot find the signal name for internal connections.
 
Does anybody know what that signal name is?  I have tried CCP4OUT and CCP4IF, but they have pulses @ 58us.
 
The wierd thing about this part of the chip is to have a period of 1.25us, I set both the T4PR and PR4 to 0x09. Does not seem to make sense. I have the timer clocked from FOSC/4, like the manual says.
 
Any help is greatly appreciated.
 
Thanks
#1

4 Replies Related Threads

    ric
    Super Member
    • Total Posts : 23598
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PWM using CCP4 of PIC16f18857 question 2019/08/11 13:44:53 (permalink)
    0
    If it's already on an output pin, can't you use TxCKIPPS to take input from that pin?
     

    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
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11286
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: PWM using CCP4 of PIC16f18857 question 2019/08/11 16:19:26 (permalink)
    0
    d2willys
    I seem to have gotten the PWM working out of the CCP4 output pin. But I need to use the signal for an internal counter and cannot find the signal name for internal connections.

     
    The block diagram shows it as CCPx_out, i.e., CCP4_out in this case.  But I can't see where you can route it to a timer, if that's your intent.
     
    The wierd thing about this part of the chip is to have a period of 1.25us, I set both the T4PR and PR4 to 0x09.

     
    They are the same register that the compiler has different names for.
    #3
    d2willys
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2019/08/08 12:29:18
    • Location: 0
    • Status: offline
    Re: PWM using CCP4 of PIC16f18857 question 2019/08/12 07:22:31 (permalink)
    0
    jtemples
    d2willys
    I seem to have gotten the PWM working out of the CCP4 output pin. But I need to use the signal for an internal counter and cannot find the signal name for internal connections.

     
    The block diagram shows it as CCPx_out, i.e., CCP4_out in this case.  But I can't see where you can route it to a timer, if that's your intent.
     
    The wierd thing about this part of the chip is to have a period of 1.25us, I set both the T4PR and PR4 to 0x09.

     
    They are the same register that the compiler has different names for.


    What I am interested in more than the internal signal is: why does the TMR4IF or CCP4IF run at a rate of 58us? This is an unusual number, which equates to ~46 periods, with periods being 1.25us each. What could possibly cause this issue?
     
    I need to be able to go 65 periods, then reset a period counter. I want to decode the period counter. This is what I am trying to do, find a signal (from TMR4) that I can use as a count enable for a period counter, and count 65 periods. It seems pretty simple, but this seems to be more difficult than I expected. I even tried CCP4OUT and still got pulses @ 58us, with nothing in between the pulses.
     
    I plan on talking to Microchip tech support today about these issues.
    #4
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11286
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: PWM using CCP4 of PIC16f18857 question 2019/08/12 10:11:07 (permalink)
    +1 (1)
     why does the TMR4IF or CCP4IF run at a rate of 58us?

     
    Because that's how you've configured it.  You haven't shown us how you've configured the timer or what your Fosc is, so it's difficult for anyone to help.
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5