Prev: Problem with simple OpAmp Circuit, need help
Next: Hey Tim, a unity gain 12 to 330 V DC converter :-)
From: john1987 on 14 Jul 2010 11:57 Hi, I need some advise on how to calculate that how fast a microcontroller can generate a sqaure wave. Calculations that involve oscillator frequency and how much an instruction will take to do it. And I also need to understand the calculation because I am trying to do pulse width modulation with frequency range between 300KHz to 500KHz. and I need to choose a microconroller. Thanks John
From: John Larkin on 14 Jul 2010 12:24 On Wed, 14 Jul 2010 08:57:22 -0700 (PDT), john1987 <conphiloso(a)hotmail.com> wrote: >Hi, > >I need some advise on how to calculate that how fast a microcontroller >can generate a sqaure wave. Calculations that involve oscillator >frequency and how much an instruction will take to do it. > >And I also need to understand the calculation because I am trying to >do pulse width modulation with frequency range between 300KHz to >500KHz. and I need to choose a microconroller. > >Thanks >John Many/most uPs have a hardware PWM generator, so instruction execution time isn't the issue. But a PWM output at 500 KHz, with 10-bit resolution, implies a clock frequency of 500 MHz. I don't know of any uP PWMs that work up that high. I vaguely recall an ARM that has a trick in its PWM that gets to sub-clock resolution. I'll ask at work, maybe one of the guys recalls it. John
From: Tim Wescott on 14 Jul 2010 12:26 On 07/14/2010 08:57 AM, john1987 wrote: > Hi, > > I need some advise on how to calculate that how fast a microcontroller > can generate a sqaure wave. Calculations that involve oscillator > frequency and how much an instruction will take to do it. > > And I also need to understand the calculation because I am trying to > do pulse width modulation with frequency range between 300KHz to > 500KHz. and I need to choose a microconroller. Many microprocessors these days -- particularly the ones with clock speeds above 100MHz -- are pipelined, so you won't get accurate timing out of them in a software loop. Of the rest, 300kHz is too fast to do anything but generate the square wave in software -- there won't be anything left over for any other processing, and damn little resolution for PWM. Fortunately, most microprocessors these days come with hardware PWM controllers that will easily do 500kHz. The time resolution of the PWM edge is generally the processor core clock time or twice that (i.e. half the core frequency). This means that with a 50MHz processor and a 500kHz PWM you'll be restricted to 1% duty cycle increments. So select a microprocessor with a PWM peripheral, then worry about what that peripheral is capable of. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
From: Tim Wescott on 14 Jul 2010 12:32 On 07/14/2010 09:24 AM, John Larkin wrote: > On Wed, 14 Jul 2010 08:57:22 -0700 (PDT), john1987 > <conphiloso(a)hotmail.com> wrote: > >> Hi, >> >> I need some advise on how to calculate that how fast a microcontroller >> can generate a sqaure wave. Calculations that involve oscillator >> frequency and how much an instruction will take to do it. >> >> And I also need to understand the calculation because I am trying to >> do pulse width modulation with frequency range between 300KHz to >> 500KHz. and I need to choose a microconroller. >> >> Thanks >> John > > Many/most uPs have a hardware PWM generator, so instruction execution > time isn't the issue. But a PWM output at 500 KHz, with 10-bit > resolution, implies a clock frequency of 500 MHz. I don't know of any > uP PWMs that work up that high. > > I vaguely recall an ARM that has a trick in its PWM that gets to > sub-clock resolution. I'll ask at work, maybe one of the guys recalls > it. Ooh -- that reminds me. TI's TMS320F283xx digital signal controllers have such PWM generators -- they run the PWM output through a selectable delay line that provides the last few bits of resolution. I haven't used one, but I have a customer who has. You can also get a more mundane PWM stage and dither the output with a sigma-delta modulator. This can work great if whatever the PWM is driving reacts slowly enough to filter the sigma-delta output. http://www.eetimes.com/design/audio-design/4006431/Sigma-delta-techniques-extend-DAC-resolution -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
From: Jon Kirwan on 14 Jul 2010 12:44 On Wed, 14 Jul 2010 08:57:22 -0700 (PDT), john1987 <conphiloso(a)hotmail.com> wrote: >I need some advise on how to calculate that how fast a microcontroller >can generate a sqaure wave. Calculations that involve oscillator >frequency and how much an instruction will take to do it. You are barking up the wrong tree, here. >And I also need to understand the calculation because I am trying to >do pulse width modulation with frequency range between 300KHz to >500KHz. and I need to choose a microconroller. There is usually a lot more than PWM to selecting a micro. That aside: What are you using the PWM for? What duty cycle resolution do you require? Do you care if the processor is 8 bit or 32 bit? What other peripherals are required? Would 250kHz be good enough or do you really require 300kHz? Either way, why? More description might help a lot. Take a look, for example, at the ATtiny26's PWM. At max resolution (8 bit, memory serving) it has a top PWM freq of 250kHz (64MHz clock using 16MHz part, I think.) What doesn't work for you, there? They are available in 20MHz, too. So that would mean 80MHz/256 would do 8 bits at 312.5kHz, I think. Jon
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Problem with simple OpAmp Circuit, need help Next: Hey Tim, a unity gain 12 to 330 V DC converter :-) |