Page 1 of 1
Reference Clock Generation Example
Posted: Wed Sep 11, 2024 6:18 pm
by KARLGROSS
Does anyone have a Flowcode example to share that would help us use the “Reference Clock Generation” block in the dsPIC33? Simply looking to direct the primary oscillator clock (labeled POSCCLK in the Oscillator System Diagram), to any RPn pin on the PIC33. Any help is appreciated!! We are using the BL00032 board for this test.
Thank you,
Karl Gross
Re: Reference Clock Generation Example
Posted: Fri Sep 13, 2024 1:54 pm
by BenR
Hello Karl,
The following C code should hopefully configure the reference clock to be an output.
Code: Select all
TRISDbits.TRISD0 = 0; //Assign D0 to be an output
RPOR0bits.RP64R = 0x31; //Assign Reference clock (0x31) to RP64 - pin D0
REFOCONbits.ROON = 0; //Ensure Reference Clock is disabled.
REFOCON = 0x0700; //Setup Reference Clock - use system clock divided by 128.
REFOCONbits.ROON = 1; //Enable Reference Clock.
Re: Reference Clock Generation Example
Posted: Fri Sep 13, 2024 6:17 pm
by KARLGROSS
Hi Ben,
Thank you for the code. It worked the first time out of the box. I want to Thank you for sharing your knowledge.