Pic 12f1572 pwm set up

For general Flowcode discussion that does not belong in the other sections.
Post Reply
siliconchip
Posts: 11
http://meble-kuchenne.info.pl
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 4 times

Pic 12f1572 pwm set up

Post 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

Steve-Matrix
Matrix Staff
Posts: 1678
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 238 times
Been thanked: 397 times

Re: Pic 12f1572 pwm set up

Post 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

BenR
Matrix Staff
Posts: 2037
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 540 times
Been thanked: 724 times

Re: Pic 12f1572 pwm set up

Post 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

siliconchip
Posts: 11
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 4 times

Re: Pic 12f1572 pwm set up

Post 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
Attachments
SOUNDDER.fcfx
(13.52 KiB) Downloaded 8 times

chipfryer27
Valued Contributor
Posts: 1779
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 396 times
Been thanked: 608 times

Re: Pic 12f1572 pwm set up

Post 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

BenR
Matrix Staff
Posts: 2037
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 540 times
Been thanked: 724 times

Re: Pic 12f1572 pwm set up

Post 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.

Post Reply