I am trying to get a 13hz pwm out of the 1501 Cant' seem to get it going at the right freq.
I set my properties in the component and enabled it. I am using channel 4 that should be RA2. I can get a 1k out but it doesn't seem to let me go below that? The display in the component looks right?
Any Ideas?
Chad
Can't get correct pwm speed going on PIC12f1501
Moderator: Benj
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: Can't get correct pwm speed going on PIC12f1501
To add what leigh said as PWM possible minimum PWM frequency is directly related to OSC frequency . another option is to use a lower OSC speed,
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Can't get correct pwm speed going on PIC12f1501
Sorry, I deleted my previous post because I realised that it should be possible to get a PWM in that range when the Int Osc is down at 31KHz,
which I now guess you are doing based on another post.
What is your actual result on hardware?
which I now guess you are doing based on another post.
What is your actual result on hardware?
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Re: Can't get correct pwm speed going on PIC12f1501
Hi Leigh,
Actually I am running at 16mhz. I was hoping that I could just set the pwn down low and let the hardware take care of blinking the led while the program did other stuff. I guess I could get creative with a timer and counters or just do it with delays..
Thanks,
Chad
Actually I am running at 16mhz. I was hoping that I could just set the pwn down low and let the hardware take care of blinking the led while the program did other stuff. I guess I could get creative with a timer and counters or just do it with delays..
Thanks,
Chad
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Can't get correct pwm speed going on PIC12f1501
Ah, right, so might deleted post applies
And as QMESAR post, the PWM max prescaler is divide by 16, and with an 8 bit counter you cannot get below that 1K.
Yes, you could consider a timer interrupt and software based counter to generate your lower frequency
And as QMESAR post, the PWM max prescaler is divide by 16, and with an 8 bit counter you cannot get below that 1K.
Yes, you could consider a timer interrupt and software based counter to generate your lower frequency
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Re: Can't get correct pwm speed going on PIC12f1501
Gotcha, I did find something else strange. Just a simple delay loop about every second I get a glitch in the output.
You can see it on the scope trace.
And this is my program.
Any Ideas? Chad
You can see it on the scope trace.
And this is my program.
Any Ideas? Chad
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Can't get correct pwm speed going on PIC12f1501
Looks like it's resetting, check watchdog timer setting
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Re: Can't get correct pwm speed going on PIC12f1501
I turned it off and it does the same thing. Power is stable and good. Totally disconnected the programmer and it still does it.
Hmmm
Hmmm
-
- Posts: 198
- Joined: Sun Nov 04, 2018 7:13 pm
- Has thanked: 27 times
- Been thanked: 33 times
- Contact:
Re: Can't get correct pwm speed going on PIC12f1501
I think I found it. It was the brown out detection. If I disable it it doesn't reset. Very strange.
Chad
Chad