BUG PWM
Moderator: Benj
BUG PWM
Incorrectly generates the PWM frequency!
If you initialize the initialization, then everything is correct!
If you initialize the initialization, then everything is correct!
- Attachments
-
- Reciever.fcfx
- Here is the project
- (5.56 KiB) Downloaded 224 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: BUG PWM
Hi Osta,
I have not got 8MHz crystal so using internal oscillator.
PWM frequency looks correct to me.
One thing I had to do first was disable PLL as you have got clock speed set to 8MHz, yet PLL enabled will make chip run at 8x4 = 32MHz.
So there is a mismatch.
What PWM frequency are you measuring and expecting?
What clock speed are you expecting hardware to run at (8 or 32MHz)?
Martin
I have not got 8MHz crystal so using internal oscillator.
PWM frequency looks correct to me.
One thing I had to do first was disable PLL as you have got clock speed set to 8MHz, yet PLL enabled will make chip run at 8x4 = 32MHz.
So there is a mismatch.
What PWM frequency are you measuring and expecting?
What clock speed are you expecting hardware to run at (8 or 32MHz)?
Martin
Martin
Re: BUG PWM
Hi, Martin!
All right!
It's not about PLL ...
I need PLL.
If the PWM initialization macro is put after the PWM settings, then everything will change and the PWM frequency will be incorrect!
The same project but with the initialization
All right!
It's not about PLL ...
I need PLL.
If the PWM initialization macro is put after the PWM settings, then everything will change and the PWM frequency will be incorrect!
The same project but with the initialization
- Attachments
-
- Reciever.fcfx
- (5.56 KiB) Downloaded 228 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: BUG PWM
Hello,
If you're using the PLL then you need to change your clock speed setting to 32000000 in the project options. The properties for the PWM component should then show you what frequencies to expect.
If you're using the PLL then you need to change your clock speed setting to 32000000 in the project options. The properties for the PWM component should then show you what frequencies to expect.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: BUG PWM
Hi Osta,
Change Clock speed from to
You are also best having Enable as first component to be accessed.
You also don't require change period if you just have a single fixed PWM frequency.
Just set correct frequency within PWM properties as at least you will know what the frequency should be.
Much better than change period.
Martin
Edit: posts crossed so information could be repeated.
In that case you must first go to Build, Project Options then General options tab.Osta wrote:I need PLL.
Change Clock speed from
Code: Select all
8000000
Code: Select all
32000000
You also don't require change period if you just have a single fixed PWM frequency.
Just set correct frequency within PWM properties as at least you will know what the frequency should be.
Much better than change period.
Martin
Edit: posts crossed so information could be repeated.
Martin
Re: BUG PWM
It works the same way ...
From the permutation of the macro, the PWM frequency changes
From the permutation of the macro, the PWM frequency changes
- Attachments
-
- Reciever.fcfx
- (5.57 KiB) Downloaded 221 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: BUG PWM
I have just tried using internal osc:
PWM from pin C5: As hardware agrees with PWM settings within Flowcode, I can't tell what the issue is?
If you can measure frequency, can you set to enabled, within configuration settings.
Then measure frequency on pin A3.
You should measure 32/4 8MHz even though clock is running at 32 MHz.
Martin
loaded 16F1824 with compiled hex.PWM from pin C5: As hardware agrees with PWM settings within Flowcode, I can't tell what the issue is?
If you can measure frequency, can you set
Code: Select all
Clock out enable
Then measure frequency on pin A3.
You should measure 32/4 8MHz even though clock is running at 32 MHz.
Martin
Martin
Re: BUG PWM
Hi, Martin !
I'm not talking about setting up.
And about the compilation ....
Here is my example.
I'm not talking about setting up.
And about the compilation ....
Here is my example.
- Attachments
-
- _Down.jpg
- Initialization at the bottom
- (932.67 KiB) Downloaded 38 times
-
- _UP.jpg
- Initialization at the top
- (937.37 KiB) Downloaded 38 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: BUG PWM
Hello,
The PWM Enable component macro calls the Change Period for you using the values in the component properties.
If you want to use values other than those specified in the properties then you need to call the Change Period macro again after enabling the PWM.
The PWM Enable component macro calls the Change Period for you using the values in the component properties.
If you want to use values other than those specified in the properties then you need to call the Change Period macro again after enabling the PWM.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: BUG PWM
Hello Benj!
I thought that the linker has priorities,
Thank you for the clarification.
Thank you Osta.
I thought that the linker has priorities,
Thank you for the clarification.
Thank you Osta.