Humm.... do you only need 1 output at the desired frequency? Are these frequencies exactly required, or would it be OK if they are=20 off a little, maybe a little low, then a little high, averaging to the=20 desired frequency? One possibility that may or may not work: do it in software, have an ISR=20 run at some convenient frequency (maybe really fast), and in the ISR you=20 turn on/off the output after some number of invocations of the ISR. You=20 can play tricks with the timer that generates the ISR (slowing down the=20 invocation rate) to give a wider range of achievable PWM frequencies,=20 and maybe you can hit the ones you need. Some=20 experimentation/calculation will be required. Another possibility, that may be easier: in your ISR, you turn on/turn=20 off the output, then calculate how many timer ticks should elapse before=20 the next turn on/off, and set the timer (that generates the ISR=20 interrupt) appropriately. If you are able to handle the fastest case=20 (1Khz with narrow on or off time) then everything else is doable. And=20 if you can't do a 1Khz with an on/off time of 1/1024 (10-bit), you could=20 just code that special case, for example. By doing some clever (if I do say so myself) coding, I was able to do=20 the ISR with timer set to expire for the next needed on/off transition=20 trick to do 32 individual 10-bit PWM channels @ 125Hz with a 40Mhz 18F6520: This software PWM generation method has the benefit of being able to=20 directly tradeoff PWM refresh rate, resolution, and number of channels. Good luck! J RNGolding@aol.com wrote: > Hi, my first request to the list, so please be gentle with me! > > I have an application that requires generation of a 10bit resolution PWM > signal at various repetition > frequencies between 100Hz and 1kHz. The PWM duty cycle and repetition > frequency commands > will be received via the serial bus @ 115200 baud. > > Required PWM frequencies are 105Hz, 140Hz, 300Hz and 1kHz, but other > frequencies may be > required in the future. > > I'm currently using a PIC18F4423 (but that can be changed if unsuitable). > Generating a 10bit PWM at a single frequency is pretty straightforward us= ing > a suitable master clock frequency and Timer 2 values but > I can't see how to get other frequencies (via PR2 value) without losing t= he > 10bit resolution. i.e. setting a PR2 register value below 255 to set th= e > other frequencies reduces PWM resolution. > > I've read the data sheet 'till I'm blue in the face and can't see a way o= f > achieving 10bit resolution at the various > frequencies. > > My present thoughts are to use two PICs. The PIC1 to generate the require= d > clock frequency for PIC2, > which generates the 10 bit PWM (PIC2 using fixed Timer 2 values). The PW= M > duty cycle demand would > then be communicated from PIC1 to PIC2 via SPI or I2C bus. > > Clumsy, but can anyone suggest a more elegant way of doing it? > > Thanks > > RNG --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .