[PIC] MPLAB-X won't set PWM frequency above 25Hz

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PIC] MPLAB-X won't set PWM frequency above 25Hz

James Burkart-2
I'm using MPLAB-X v5.35, and XC-8 v2.20.

Using PIC16F1503. Brand new stand alone project. Set internal frequency to
16MHz. TMR2 period set to 250ns. PWM frequency shows 25Hz. Nothing I do is
setting the PWM frequency correctly. What am I missing here? I'll have to
dig out my stuff to breadboard it and see what the actual PWM frequency is,
but this is frustrating.

I'd like to set the timer period to 64 us and get a PWM frequency of 15.625
kHz.
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: [PIC] MPLAB-X won't set PWM frequency above 25Hz

Forrest Christian (List Account)
I'm curious where you're seeing these values, Is this in MCC or something
like that?

So, here are random thoughts:

Is the processor really running at 16Mhz?   Blinking a led with a delay
loop is a good way to verify this.

If you're running at 16Mhz, it seems like if you set the timer prescale to
1, and then set a PR2 value of 0xff you'd get where you want to be.

That is 16Mhz/4 = 4Mhz(Fosc/4) / 1 = 4Mhz / 256= 15.625kHz

On Sun, Jul 19, 2020 at 10:06 PM James Burkart <[hidden email]>
wrote:

> I'm using MPLAB-X v5.35, and XC-8 v2.20.
>
> Using PIC16F1503. Brand new stand alone project. Set internal frequency to
> 16MHz. TMR2 period set to 250ns. PWM frequency shows 25Hz. Nothing I do is
> setting the PWM frequency correctly. What am I missing here? I'll have to
> dig out my stuff to breadboard it and see what the actual PWM frequency is,
> but this is frustrating.
>
> I'd like to set the timer period to 64 us and get a PWM frequency of 15.625
> kHz.
> --
> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist
>


--
- Forrest
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
Reply | Threaded
Open this post in threaded view
|

Re: [PIC] MPLAB-X won't set PWM frequency above 25Hz

James Burkart-2
Sorry, yes, MCC. I'm pretty sure I have a DIP package 16F1503 somewhere, so
hopefully this afternoon I can dig it out and see what I can find out. But
I've never experienced this before in MCC.

--
James B

On Mon, Jul 20, 2020, 3:40 AM Forrest Christian (List Account) <
[hidden email]> wrote:

> I'm curious where you're seeing these values, Is this in MCC or something
> like that?
>
> So, here are random thoughts:
>
> Is the processor really running at 16Mhz?   Blinking a led with a delay
> loop is a good way to verify this.
>
> If you're running at 16Mhz, it seems like if you set the timer prescale to
> 1, and then set a PR2 value of 0xff you'd get where you want to be.
>
> That is 16Mhz/4 = 4Mhz(Fosc/4) / 1 = 4Mhz / 256= 15.625kHz
>
> On Sun, Jul 19, 2020 at 10:06 PM James Burkart <[hidden email]>
> wrote:
>
> > I'm using MPLAB-X v5.35, and XC-8 v2.20.
> >
> > Using PIC16F1503. Brand new stand alone project. Set internal frequency
> to
> > 16MHz. TMR2 period set to 250ns. PWM frequency shows 25Hz. Nothing I do
> is
> > setting the PWM frequency correctly. What am I missing here? I'll have to
> > dig out my stuff to breadboard it and see what the actual PWM frequency
> is,
> > but this is frustrating.
> >
> > I'd like to set the timer period to 64 us and get a PWM frequency of
> 15.625
> > kHz.
> > --
> > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
> > View/change your membership options at
> > http://mailman.mit.edu/mailman/listinfo/piclist
> >
>
>
> --
> - Forrest
> --
> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
> View/change your membership options at
> http://mailman.mit.edu/mailman/listinfo/piclist
>
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist