Page 1 of 2

PWM Woes

Posted: Sun May 11, 2025 6:23 pm
by alanwms
Attempting to do a small test with PWM on FC10 with PIC12f1840. I can't get a scope signal on the PWM using simulator. Any ideas? See attached test

Re: PWM Woes

Posted: Mon May 12, 2025 7:58 am
by medelec35
Hi Alan.
It looks like the attachment has not been added.

Re: PWM Woes

Posted: Mon May 12, 2025 7:26 pm
by alanwms
I don't know how to attach anymore?

Re: PWM Woes

Posted: Mon May 12, 2025 7:27 pm
by alanwms
Here it is

Re: PWM Woes

Posted: Mon May 12, 2025 9:42 pm
by chipfryer27
Hi

In your component properties you forgot to assign your PWM timer.

Once assigned (in this case timer 2) you can then base your duty cycle on your Period value. You have chosen 1000Hz which FC calculates out as Prescaler = 64 and Period = 77 for your oscillator values (external, 20MHz).

I usually set this in the chart too.

You can then figure out your values to give 0-100% cycles based on your PIC capabilities.

Regards

Re: PWM Woes

Posted: Mon May 12, 2025 10:02 pm
by alanwms
I tried that a few times. Currently I have tmr2 assigned. but the simulated scope shows a dead line. Pic chip is 12f1840

Re: PWM Woes

Posted: Mon May 12, 2025 10:03 pm
by alanwms
Scope meaning the simulated scope in FC

Re: PWM Woes

Posted: Mon May 12, 2025 10:13 pm
by chipfryer27
Hi

I have no access to hardware at present but the component gave the correct responses to my test values when simulating. If I get time later I'll look at "scope", but did you set it on the correct pin?

Regards

Re: PWM Woes

Posted: Tue May 13, 2025 1:27 pm
by alanwms
I have no hardware at this time. I'm simply attempting to assure operation using the scope component so I can verify theoretical output. I may hook up the chip for test if I can't get the simulation scope to play.
I assigned multiple pins to the scope thinking that the incorrect pin was allocated - no luck. All four traces dead. No pins worked for me. I am pretty sure I'm not setting something in FC?

Re: PWM Woes

Posted: Tue May 13, 2025 2:03 pm
by medelec35
Hello.
many thanks for letting us know.
I can replicate the issue.
I will look into this and see if I can set it sorted.