I am not familiar with PICs, but run into problems with Atmega doing that. It will be quite hard to run programm code to check buttons, encoders, update lcd and avoid conflicts with PWM rutines. I would sugest to go for separate small micro (kind of attiny 20MHz or PIC equivalent) for PWM. I also whould suggest to add fast pulse out on that micro (changes OC1A pin), which can provide fout up to Clock / 2 MHz.
Most of the code will be interrupt driven. The
PIC16F18855 (or its bigger brothers) which I'll most likely be using has a ton of core-independent peripherals so there won't be too much coding. It also has a NCO (Numerically Controlled Oscillator) module which I will probably use for the square wave once I fully understand how it works (not that difficult).
Another nice feature of this micro is the PPS module which allows assigning different peripheral inputs or outputs to I/O pins which will allow me to switch between NCO output and PWM output on the same I/O pin.
Going to start a topic on the User Interface Project at some point in the near future, after I get most things figured out.
The PWM output from the µC can run in the background as long as you stay within the 16 bit range of the hardware timers. If you need extended resolution it can get tricky.
However the output from the DDS and comparator is still different and sometimes superior, as it can give fine frequency adjustment, just as for the sine wave. The PWM output from the CPU has only coarse resolution at high frequencies - so it is not a full replacement.
I'm aware of that but decided I don't need very high resolution for frequency or duty cycle and I don't need continuous frequency adjustment either, preset values will do.
PWM modules start at 10bit resolution which goes down as you increase the frequency.
For Fosc = 32MHz the PWM module's minimum output frequency would be slightly below 2kHz for the older PICs because of the limited Timer2 clock prescaler values (1, 4, or 16). However the one I'll be using has prescaler options ranging from 1 to 128 which means I can have the PWM output down to 250Hz. That'll do. I'm also ok with 1% steps for duty cycle.