Scott Dattalo wrote: > If I understand you correctly, you basically want a 16-level pwm output > with a frequency somewhere between 20-30 khz from a 16c84(?) running off > of a 4Mhz crystal. If you do the arithmetic, that comes out to between > 50 - 33 instruction cycles per pulse. (4Mhz / 4 / 20khz) That's tough! You're telling me! I'm using a 12c508. > You might wish to check out my single-cycle resolution 256 level pwm or > 32 level pwm: > > http://www.interstice.com/~sdattalo/technical/software/pic/pwm.txt > http://www.interstice.com/~sdattalo/technical/software/pic/pwm256.txt Thanks, I'm going there now... > However, it might be more feasible to implement an intertwined > isochronous routine (iir - okay I made it up). Do you remember Dwayne I thought that an isochronous approach should work. > Reid's pulse sampling problem a couple of months ago? I don't have time > to elaborate right now, but maybe someone else can (Dwayne?). But > basically, you can get a resolution of about 3 instruction cycles with > the algorithm. So in your case, you could have 16 levels * 3 > instructions/level for 48 instructions per pulse. This also gives you 16 > instructions per pulse for other processing (like sampling Vds and > determining the next pulse width). Just over 20kHz! Dwayne! Give us you input! I'll post a shematic of the circuit I built later. -- Friendly Regards Tjaart van der Walt mailto:tjaart@wasp.co.za |--------------------------------------------------| | WASP International | |R&D Engineer : GSM peripheral services development| |--------------------------------------------------| |SMS mailto: tjaart@sms.wasp.co.za (160 chars max)| | http://www.wasp.co.za/~tjaart/index.html | |Voice: +27-(0)11-622-8686 Fax: +27-(0)11-622-8973| | WGS-84 : 26¡10.52'S 28¡06.19'E | |--------------------------------------------------|