System.setPeripheralFrequency

Name
System.setPeripheralFrequency

Description

 * void System.setPeripheralFrequency ( u32 freq )


 * Sets the clock rate for peripherals.

Syntax
System.setPeripheralFrequency( freq );


 * Returns/Output
 * None

Example
System.setPeripheralFrequency(4000000); // Set Peripheral frequency to 4MHz

Comments
The 8-bit PIC® MCU System Clock is always designated as Fosc in data sheets. The Peripheral Clock is derived from the Fosc through a divider to deliver a frequency clock of Fosc/4 (1/4 the oscillator speed).

System.setPeripheralFrequency(4000000); will then involve a System Clock at 16MHz

on the other hand System.setCpuFrequency(16000000); will involve a Peripheral Clock at 4MHz

The 32-bit PIC® MCU System and Peripheral Clock ratio is not fixed and can be changed. So it's possible to have :

System.setPeripheralFrequency(10000000); // Peripheral running at 10MHz

and System.setCpuFrequency(80000000); // System running at 80MHz (PIC32MX family 3 and above)