Quick side note, you can produce a PWM signal with the PWM Module as well as Output Compare. With the PWM Module you are locked into specific PORT Pins (PWM1H, PWM1L, PWM2H...). With Output Compare, you can use PPS to assign the output to any RPx pin. I found for a simple PWM the OCx Function is easier to work with than the PWM Function. You still get >16-bit resolution using the OCxR and OCxRS registers.
I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.