Minimum frequency for PWM?

Cillakin

Member
Hello friends! A project that I am undertaking requires a square wave, reasonably fast, anywhere from 700KHz up to 35MHz is prime target range. Preference is for 4-30MHz for the given application. The datasheet on the 08M2 and 18M2+ both specify the maximum frequency as set by the internal oscillator, if I'm not mistaken I think it was 32MHz. In any case all I want to know is if the chips can provide (source) that kind of frequency? Can the 08M2 and 18M2+ provide square waves in this range?
I did not see anything that noting that the clock and output freq were different, so I assume you can provide square waves up to that freq? Thanks again friends for all your help. :D
 

BeanieBots

Moderator
Your request is a bit confusing.
The title mentions MINIMUM but your text describes EXTREMELY high frequencies.
Do you REALLY mean MHz. This is RF stuff and requires complex PCB layout design, filtering and care.

Have a read in the manual under "PWMout" and check out the PWMout wizard in the PE for details of what is possible and how to calculate what frequencies are possible.
 

srnet

Senior Member
As ever, some indication as the the 'application' might yield useful suggestions from forum members.
 

Cillakin

Member
I suppose I should add some clarity to my above post. The application is just to drive a LRC circuit. As for minimum I got the answer from a relative, my question was a little misplaced. However, I suppose I will explain. It was my impression that some micros can only switch at certain speeds. A maximum, which I assume to be about 4 times less than the clock frequency. A minimum frequency that it can go. But the question was moot because it is just a matter of setting a pause/delay. Pardon me being stupid. Apologies. :p
 

Goeytex

Senior Member
The PWM wizzard will allow a PWM frequency of 32MHz max with a Picaxe operating at 64Mhz. However, there will be no output at 32MHz . For all practical purposes 2 Mhz is about the limit. At 2Mhz there will 5 bits of resolution for duty cycle. To get 6 bts of resolution (64 steps) the frequency must drop to 1 MHz. The practical speed and duty is determined by the pwm signal rise time of ~49ns and fall time of ~39ns.

So, a Picaxe is not the right microcontroller for your application. You may want to look at the specs for a dsPIC and see if that will meet your requirements.
 

srnet

Senior Member
As BeanieBots suggests, put some values into the PE PWM wizard, it will tell you when the frequency you select is out of range.
 

Goeytex

Senior Member
But the question was moot because it is just a matter of setting a pause/delay.
As you are probably aware, the Picaxe uses interpreted BASIC where the BASIC Interpreter resides in the chip. This means that there will be significant overhead when processing commands. It will not be 4 clock cycles like a PIC using compiled C. More on the order of 200+ clock cycles.

For example with an X2 Picaxe operating at 64MHz the fastest signal you can get using NO DELAY when toggling a pin high / low is about 7.45Khz

Code:
do
    toggle b.7
loop
(Output = 7.474 KHz)
 
Top