Question: Configure and code clock for Pic24e. a) Report how to configure bits to use its fast RC oscillator with PLL to run at 40MHz. Assume

Configure and code clock for Pic24e.

a) Report how to configure bits to use its fast RC oscillator with PLL to run at 40MHz. Assume the RC's frequency is 7.5MHz.

b) Report how to configure bits to use its primary crystal (XT) with PLL to run at 40MHz. Assume the external clock is a crystal oscillator of 8MHz.

Refer to the example code included below. Modify the code and copy and paste the code in your report (excluding the comments).

* If you do not know the answer then please do not respond with some wrong answer.

//CODE//

#include "ConfigurationBits.h"

void initializeSystem() {

// Configure the device PLL to obtain 60 MIPS operation. The crystal

// frequency is 8MHz. Divide 8MHz by 2, multiply by 60 and divide by

// 2. This results in Fosc of 120MHz. The CPU clock frequency is

// Fcy = Fosc/2 = 60MHz.

PLLFBD = 58; /* M = 60 */

CLKDIVbits.PLLPRE = 0; /* N1 = 2 */

CLKDIVbits.PLLPOST = 0; /* N2 = 2 */

/* Initiate Clock Switch to Primary

* Oscillator with PLL (NOSC= 0x3)*/

__builtin_write_OSCCONH(0x03);

__builtin_write_OSCCONL(0x01);

while (OSCCONbits.COSC != 0x3);

// Wait for PLL to lock

while (OSCCONbits.LOCK != 1);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!