Reference Clock Generation Example

Use this section to discuss your embedded Flowcode projects.
Post Reply
KARLGROSS
Posts: 11
http://meble-kuchenne.info.pl
Joined: Sat Dec 19, 2020 11:53 pm
Been thanked: 1 time

Reference Clock Generation Example

Post 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

BenR
Matrix Staff
Posts: 1912
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 496 times
Been thanked: 674 times

Re: Reference Clock Generation Example

Post 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.

KARLGROSS
Posts: 11
Joined: Sat Dec 19, 2020 11:53 pm
Been thanked: 1 time

Re: Reference Clock Generation Example

Post 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.

Post Reply