At 12:04 PM 03/06/2000 PST, you wrote: > [self-modifying code.] > > Also, I was thinking more along the lines of the lookup table > being in RAM, not compiled in. So you just modify the RAM table > for different duty cycles - although that would take a few cycles. > >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! */ ... ... >BillW > Speaking of self-modifying code, Jim Newton has been discussing the idea of trying to get a PIC '877 to work as a single-chip, multipurpose downloader/debugger/monitor. Sounds like it might be able to recompile your table on the fly, too. And speaking of modifying lookup tables in RAM, as it turns out, this approach can be used to make a nice multi-phase, multi-pulse function generator in s.w. On the scenix you can easily go 5 Mhz, on the PIC maybe 500 Khz. Besides 8-channel PWM, you can produce parallel outputs like 1 110000000000000000000000000000 2 001111111111110000000000000000 3 000111111111111000000000000000 4 000011111111111100000000000000 5 000001111111111110000000000000 6 000000111111111111000000000000 7 000000011111111111100000000000 8 000000001111111111110000000000 [although I can't for the life of me understand why anybody would want to do something like this]. regards, - Dan Michaels