Micro 16F628 - A PWM signal used to control a DC motor, requires, when stopped, to have the PWM output pin (RB3) low.
Initially, I (wrongly) tried BCF T2CON,TMR2ON but realized that the output stays high, most of the times, so I resorted to add CLRF CCPR1L. Still the same problem :?: :!:
From the manual: The CCP1 pin is set (exception: if PWM duty cycle = 0%, the CCP1 pin will not be set)
Question a) What could be the reason I don't get that result?
-----------------------------------------------------------------------
Later, with CLRF CCP1CON i've got the output becoming low.
Question b) Is there a simpler way than CLRF CCP1CON to stop the PWM with output pin low?
To restart I have to set it up again as PWM (could I avoid this?) and then, if needed, to reload b4:b5 with the LSB of the duty cycle value. I feel that changing the setting of a peripheric to stop it, is not correct (or at least, excessive!!)
Initially, I (wrongly) tried BCF T2CON,TMR2ON but realized that the output stays high, most of the times, so I resorted to add CLRF CCPR1L. Still the same problem :?: :!:
From the manual: The CCP1 pin is set (exception: if PWM duty cycle = 0%, the CCP1 pin will not be set)
Question a) What could be the reason I don't get that result?
-----------------------------------------------------------------------
Later, with CLRF CCP1CON i've got the output becoming low.
Question b) Is there a simpler way than CLRF CCP1CON to stop the PWM with output pin low?
To restart I have to set it up again as PWM (could I avoid this?) and then, if needed, to reload b4:b5 with the LSB of the duty cycle value. I feel that changing the setting of a peripheric to stop it, is not correct (or at least, excessive!!)