What you are trying to do is almost impossible when using the PIC24FJ256GB410 PIM and the DM240001-3 Explorer 16/32 development board.
The first issue in this hardware configuration is that all of the LEDs (D3 to D10) are connected to PORTA RA0 to RA7, and these GPIO pins cannot be selected as target pins to map output function on.
This means that OC1, OC2, OC3, OCM4, OCM5, OCM6 or OCM7 cannot be used to drive LEDs attached to PORTA.
Now OCM1, OCM2, OCM3, OC4, OC5 and OC6 have fixed pin mappings. Only OCM1 has any outputs on PORTA. OCM1E is attached to RA6, OCM1F is attached to RA7. This results in only one PWM modulator output to drive an LED.
Attached is an MPLABX v5.10 project with a MCC configuration file that builds code to enable OCM1F to drive RA7 with a 40KHz 50% duty cycle PWM output.
Note that this code can only be tested in the real hardware. The MCCP simulation model for the PIC24F family in the MPLABX v5.10 simulator only works when the steerable output is selected as the OCM1A output.
post edited by dan1138 - 2019/07/21 02:06:22