Page 1 of 1
Pic 12f1572 pwm set up
Posted: Tue Dec 16, 2025 8:17 pm
by siliconchip
Hi all
Im currently trying to set the pwm function on my target chip the 12f1572. So far im not achieving any thing i cant get an output and my pwm knowledge is nil. In a previous post i was told to just put set frequency value in and this would suffice but again cannot get it to work.
Please can someone help me from scratch im going insane lol
Cheets bob
Re: Pic 12f1572 pwm set up
Posted: Wed Dec 17, 2025 9:14 am
by Steve-Matrix
I did a quick search on our old forum and found this post which may help you get started:
https://flowcode.co.uk/mmforums/viewtop ... 572#p81436
Re: Pic 12f1572 pwm set up
Posted: Wed Dec 17, 2025 12:59 pm
by BenR
Hi Bob,
Attaching your Flowcode project file would allow us to see what you have tried and then be able to comment a lot better on what to try next. It's likely something simple but without your project file we are guessing.
Have you started with the one second flasher as a basic sanity check?
https://www.flowcode.co.uk/wiki/index.p ... ED_flasher
Re: Pic 12f1572 pwm set up
Posted: Wed Dec 17, 2025 4:06 pm
by siliconchip
hi ben,
please find enclosed my program, i can confirm config is ok and i get a led flashing, ive cobbled bits together from other things ive seen and managed to get the duty cycle as i wanted with setting the pwm at 8KHz, however i cannot get the output on hardware at port A 1 to work, ive also tried using the pwm component macros ie set frequency, duty cycle etc but still no joy, adjusting the PR2 value allows me to change the rollover and hence the duty cycle something i used when toggling an output in a previous project, its obvious im still going wrong hopefully you will be able to shed some light on things thanks in advance
bob
Re: Pic 12f1572 pwm set up
Posted: Wed Dec 17, 2025 8:54 pm
by chipfryer27
Hi
I might have one of this chips lying around. If so I'll try your code tomorrow and see what happens.
Regards
Re: Pic 12f1572 pwm set up
Posted: Thu Dec 18, 2025 10:14 am
by BenR
Hello,
Normally the PWM on a PIC is tied to a timer peripheral but on this device it looks like they've totally redone the PWM peripheral with a completely new setup that's tied to the oscillator.
I'm looking into it for you but it looks like it's not an easy fix.
Re: Pic 12f1572 pwm set up
Posted: Thu Dec 18, 2025 4:03 pm
by chipfryer27
Hi
Just checked and I don't have that chip. However reading Ben's post above it wouldn't have mattered if I had
Regards