William Chops Westfield wrote: > Right. They're very similar. I was thinking along the lines of: > > for (i=0; i < 256; i++) { > PWMCODE[i] = asm("NOP"); /* More fictional syntax! */ > } > for (i=0; i < 8; i++) { > PWMCODE[stoptime[i]] = asm("BCF port, i"); .. etc.. Along my principle of maximising the number of transitions per cycle to optimise filtering, rather than minimising it, if one is to dedicate a whole table to the process, it would seem desirable to use a pattern similar in some sense to Gray code, to interleave the bits. The MSB should firstly (or lastly, however it works) be allocated to every second bit, next MSB to every fourth bit between, next MSB every 8th and so on. Alternately, completely opposite tack, it does seem that since only 16 transitions overall would suffice to code 8 PWM waveforms, there must be an algorithm to allocate these so no two channels ever (need to) switch at once. This will assist in optimisation of filtering the power supply (EMI etc...) powering the end devices. Mathematical ponder - is it possible to resolve every case of eight separate and independent PWM functions so that all 256 states contain a transition? If not, can 128 states always be filled? Solution for all successive transitions to be opposite? Hmmm. -- Cheers, Paul B.