On Tue, Jun 21, 2011 at 6:53 PM, Brent Brown wrot= e: > > Wondering what factor(s) dictate the max spec of 250Hz? A minimum spec > would > be important to minimise flicker. Even so LED flicker can be noticeable > well above > 250Hz in some conditions. If there is no good reason why not then higher > freq > would be better and your problem goes away. > I know that no text can ever be aligned properly, but here's a cut/paste from the data sheet. Parameter Symbol Min. Typ. Max. Unit PWM frequency fPWM 200 300 400 Hz I have to follow the spec, lest some PICLister rise up and smite me for straying beyond the ratings. Also to ensure it works. On Tue, Jun 21, 2011 at 6:57 PM, IVP wrote: > > 2. PWM in software > > Barry, I have a PIC running at 40MHz that puts out 6-bit PWM > from 100Hz to 279Hz > > There is plenty of spare processing power and could be expanded > to 7-bit or faster/slower speeds > I'm not certain what I was looking at there, or how you determine that the output would be sufficiently stable to not be seen in my specific application....but what you did remind me is, that if I dump the hardware PWM idea, I can go back to higher processor speeds and most of these software methods ought to work out fine. BTW, I, too, have made pulse generators out of junked LCD+PIC boards we hav= e kicking around here. After watching them rent omigosh-priced function generators to do things like make tones and simulate buttons being pushed, = I went and made my own. That's how I confirmed what the lower frequency limi= t was--I could try it. Never could come up with an easy power supply for them, though. Until now. I have abandoned my purist USB-is-not-a-power-supply views and joined the ranks of the lowlife laptop fan and light-em-up-plug-in-sushi makers, and now I hang surplus USB cords on everything I want to power. Also wonder how you got from "Jinx" to "IVP". On Tue, Jun 21, 2011 at 9:30 PM, RussellMc wrote: > > On_IRQ > increment counter ; with rollover to zero > if counter =3D 0 then set all PWM output bits high. > for all channels > if counter >=3D channel_value set relevant PWM bit low. > Looks suspiciously like a software rendering of the PIC PWM peripheral. Or a good explanation of same to anyone who hasn't grasped how the Microchip one works. I did do something like this some years ago on a PIC12C671 for = a fan, where the rep rate was 10 Hz. But even if there was any jitter in the pulse width, the fan would have hidden it completely. Today's adventure involves a light source, the human eye, and that irascible brain that's attached to it. On Tue, Jun 21, 2011 at 10:48 PM, IVP wrote: > > I've got LED displays refreshed at 300Hz and that they aren't > static is obvious if you move your head or roll your eyes. > Along with those danged automobile tail lights. [Here the topic strays off into speculation about persistence times for LED's possible phosphors, psycho-visual effects, and, of course, wallet moths. Until...] On Wed, Jun 22, 2011 at 8:07 AM, Denny Esterline wrot= e: > > [the stated software method seems]..."less than optimum". > > With this scheme you have a _ton_ of interrupts. 8 bit resolution gets yo= u > 256 interrupts per PWM cycle... > > [followed by an algorithm that alternately loads the timers with the ON > time and then the OFF time...] > This is another interesting idea that I would probably try if given enough time--which, it seems, I'm not. I've always been a bit concerned with reloading timers and accounting for the extra time before the program gets to the load-timer part. Exacerbated by the fact that I write the firmware using a certain language whose name is a single letter that occurs early in the alphabet. On Wed, Jun 22, 2011 at 8:45 AM, Michael Watterson wrote= : > > Not if you are doing something else that needs the fixed rate higher > speed interrupt. Which is common. Like a Multiplexed LED display or ADC > or Frequency counter or simple DSP > That's true. I've always had a 1ms interrupt running and used it to signal everything else when to run. But a maybe best-case need for a 50 us interrupt might be a bit much for the poor thing. I may have to look at Denny's suggestion after all. On Wed, Jun 22, 2011 at 11:52 AM, Sergey Dryga wrote: > > You can use TMR2/4/6 with postscaler to generate interrupts. Load PRx > register > with value for pulse or blank. This will generate only 2 interrupts per > cycle. > Another way is to use CCP module with 16-bit registers (page 182 of the > datasheet), this will give you a better resolution by avoiding post-scale= r. > In > the special event IRQ load correct values for the duration of pulse or > blank. > Haven't grokked this entirely but a read through the timers section once again will probably explain this. I like the apparent "hack" to get a 16-bit timer. I appreciate the thought you guys have put into this. Barry --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .