Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC PWM Signal

Status
Not open for further replies.

drkidd22

Member
Hello,

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?

TEK0012.JPG
TEK0017.JPG
 
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.

Either way those osc snapshots are not right.
 
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?

John
 
What is the pin driving? Is there any way to easily disconnect what is being driven so you can see the actual pin voltages of the PIC?

John
 
What is the pin driving? Is there any way to easily disconnect what is being driven so you can see the actual pin voltages of the PIC?

John

Good question.... How are you driving your solenoid..
 
I took the scope measurement with the circuit driving the solenoid removed. This is straight measurement from the output pin.
 
I am not aware that PIC pins can be driven to negative voltages under program control.

Can you please post your circuit?

edit: You are using a common ground, right?

John
 
Last edited:
Probe set to "AC" huh? ;)

... Remember!! The output of pic PWM is weird when the duty cycle is larger than the period.
...

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?
 
Probe set to "AC" huh? ;)



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?

I'll see if I can replicate what I did, then I'll post a screenshot....... I didn't get what I was expecting that's for sure...

It was a 12F1840...

BTW I now think that the probes earth wasn't connected on the OP's circuit.....
 
Last edited:
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.
TEK0023.JPG

Then I drop the duty to 57% after it's solenoid open.
TEK0022.JPG
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top