3 channel PWM with customize duty cycle


Results 1 to 40 of 57

Threaded View

  1. #26


    Did you find this post helpful? Yes | No

    Default Re: 3 channel PWM with customize duty cycle

    hi,
    thks for the explanation, now my pwm works fines.
    attached is my currently pwm pattern for ccp1 and ccp2.
    NOw, i want to shift the CH2 pwm about 1/3 of the duration of the CH1 pwm which is

    10.20ms/3 = 3.4ms

    so, i intend to put pause command at:

    Main1:
    'For duty1 = 0 TO 44

    'Go into the table AND retrieve the value pointed at by Duty1 AND put that value in Duty2
    LookUp2 duty1, [0,70,137,208,275,341,408,470,529,588,643,694,745,7 88,827,866,898,925,_
    953,968,984,996,1000,996,984,968,953,925,898,866,8 27,788,745,_
    694,643,588,529,470,408,341,275,208,137,70,0],duty2



    'Duty2 now contains the value from the lookup table that Duty1 points at. First time thru the loop it's 0 second time it's 18 and so on.

    CCP1CON.4 = duty2.0 ' Setup 10-bit duty cycle as
    CCP1CON.5 = duty2.1 ' a 10-bit word
    CCPR1L = duty2 >> 2

    Pause 4
    CCP3CON.4 = duty2.0
    CCP3CON.5 = duty2.1
    CCPR3L = duty2 >> 2

    PauseUs 210 'Use each dutycycle value 10ms before going to the next one.
    'Next duty1
    'PauseUs 100

    GoTo Main1


    but seem like ccp1 and ccp2 pwm duration increase above 10.20ms.
    SO, what should i adjuzt to make pwm CH2 shift 1/3 of the pwm CH1
    without increasing the duration?

    thks
    photoelectricName:  F0000TEK.JPG
Views: 2615
Size:  117.5 KBName:  F0000TEK.JPG
Views: 2615
Size:  117.5 KB
    Last edited by photoelectric; - 20th April 2011 at 05:48. Reason: add attachment

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts