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
photoelectric![]()
Bookmarks