• AVR Freaks

Hot!PIC18F24K42 - CLC with PWM won't play ball

Author
acharnley
Super Member
  • Total Posts : 315
  • Reward points : 0
  • Joined: 2016/05/01 06:51:28
  • Location: 0
  • Status: offline
2019/04/06 05:39:41 (permalink)
0

PIC18F24K42 - CLC with PWM won't play ball

I have a CLC configured in JK mode using a 1s timer to create a 50% pulse. It works perfectly, I can forward to an LED and see the output.

I have a PWM supplying a varying duty cycle but let's say 70%. I have this going to an LED so can see the output.

I now feed the 1st CLC and the PWM into a second CLC, the idea being to use the PWM duty when the 1st CLC has output. The output of CLC #2 goes to another LED.

CLC output is 0. If I configure both inputs to be CLC #1 the LED works, so for some reason it's not accepting the PWM input. I've tried two PWM peripherals and lowered the PWM frequency to ~ 400Hz (as low as possible).

Any ideas?



Attached Image(s)

#1

4 Replies Related Threads

    mpgmike
    Super Member
    • Total Posts : 253
    • Reward points : 0
    • Joined: 2014/01/23 17:27:06
    • Location: NJ
    • Status: offline
    Re: PIC18F24K42 - CLC with PWM won't play ball 2019/04/06 09:38:37 (permalink)
    0
    Try using 4-AND Mode.  Feed CLC1 into CLC2SEL0 and your PWM into CLC2SEL1; then use CLC2SEL0 as input to CLC2GLS0, and CLC2SEL1 as input to CLC2GLS1_2_3.  Perhaps there is a cleaner method, but this one works for me.
    #2
    acharnley
    Super Member
    • Total Posts : 315
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: PIC18F24K42 - CLC with PWM won't play ball 2019/04/06 10:01:01 (permalink)
    0
    I've finally solved it, there's a bug in MCC which allow CLC4 to map to PORTC output. Same goes for CWG3.

    It's cleaner IMO to route the PWM to CWG and set the CLC to invoke a shutdown on it.
    #3
    acharnley
    Super Member
    • Total Posts : 315
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: PIC18F24K42 - CLC with PWM won't play ball 2019/04/06 10:52:34 (permalink)
    0
    A more thorough investigation, CWG3[B,C,D] outputs are not mapping through PPS despite being set for a correct PORT. I am forced to use CWG3 for PORTA but it appears to be broken. Other CWG's work correctly. I've also set the PPS manually as per the datasheet rather than rely on MCC.
    #4
    acharnley
    Super Member
    • Total Posts : 315
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: PIC18F24K42 - CLC with PWM won't play ball 2019/04/06 11:43:53 (permalink)
    0
    Kicking myself, had them disabled in the peripheral disable section. Arghh.
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5