2017-09-26 03:44 AM
Dear All
I am trying to generate the variable frequency PWM on SPC570s following the documents
'SPC570Sx 32-bit Power Architecture
�
microcontroller for automotive ASILD applications' page 759 Usage of Compare Registers
I am using the dual compare registers COMP1 and COMP2 to generate
variable
frequency PWM. I always get problems 'when changing COMP1 and COMP2 while the counter is active
', the termUse caution when changing COMP1 and COMP2 while the counter is active. If the counter has already passed the new value, it will count to 0xFFFF or 0x0000, roll over, then begin counting toward the new value. The check is: CNTR = COMPx,
not
CNTR > COMP1 or
CNTR < COMP2. That why I used CMPLD1 and CMPLD2 to pre-load the value of COMP1 and COMP2.
The problem is whenever I use interrupt to change (update new) frequency by changing CMPLD1 and CMPLD2. Although at the beginning, the PWM looks good, however, they do not become complementary PWM anymore when the Frequency is changed in interrupt.
Best Regards
#spc570s #variable-frequency-pwm