This is a sample code showing a minimal configuration of a DsPIC30F4012 to get on RE0 a high level (logical 1) of a duration of one cycle at 20MIPS from an external crystal of 5MHz. The aim is to validate a simple design by verifying :

To do that, one file have to be added to a blank project in MPLABX using C30 or XC16 compilers :

#include <p30fxxxx.h>;

_FOSC(CSW_FSCM_OFF && XT_PLL16);
_FWDT(WDT_OFF);
_FBORPOR(PBOR_OFF && MCLR_EN);
_FGS(CODE_PROT_OFF);
_FICD( ICS_PGD );

int main(void) {
    OSCCONbits.POST = 0b01; // Datasheet page 7-14
    TRISE = 0; // Port E en sortie
    LATE = 0; // Initialisation du port E à 0

    while(1) {
        LATEbits.LATE0 = 1;
        LATEbits.LATE0 = 0;
    }

    return 0;
}