I'm working on a solenoid control and found the PWM signal from the DSpic as shown in images below. I'm having trouble trying to figure out what's the duty cycle for each one and what the avg dc voltage would be. I'm familiar with the regular square wave PWM that stays above 0, but this PWM signal also goes below 0. Can someone please explain.
The frequency is 24Khz for both waves. They are shown at different duty cycles.
How do I determine the duty cycle by looking at the scope images?
What is my average DC output?
They are not PWM signals.... PWM signals ARE square waves, as you said, with varying pulse lengths..
That signal looks like you have no protection across your solenoid, or your ground isn't stable.. Remember!! The output of pic PWM is weird when the duty cycle is larger than the period.
The second looks like the 1st derivative of a duty cycle that is >50%. The first would be a duty cycle that is considerably shorter. Can you show the circuit you actually used, particularly the way you measured them? Do you have DC coupling on your scope?
Do you have any more info on this please? From what I remember of most PICs PWM modules the output is set on when the count register =0 and clear to off when the count register = the PWM value, so if the PWM value is larger than the period I think it just never turns off and you get the output constantly on?
Do you have any more info on this please? From what I remember of most PICs PWM modules the output is set on when the count register =0 and clear to off when the count register = the PWM value, so if the PWM value is larger than the period I think it just never turns off and you get the output constantly on?
No, just a bad probe. Like dead/broken. My probe ground was connected to the circuit. I had the PWM in the source code correct, just that I grabed a bad probe from the toolbox. PWM works fine.
Look at the below two wave forms with the good probe. The probe was acting as a load or something I guess.
88% Duty to open up the solenoid.
Then I drop the duty to 57% after it's solenoid open.