Lets jump back to the system frequency.  Here is something to make controlling the system clock a little easier.  Just include osc.c and osc.h in your project.

It provides the following functions.

void cpuFreqSelect(uint8_t speed);  //Set CPU Frequency to desired speed
void enableClockReferenceOut (void);  //Enable OSC Clock Reference Output
void disableClockReferenceOut (void);  //Disable OSC Clock Reference Output

cpuFreqSelect – Takes the following Values

MHZ16   – Set to 16MHz
MHZ8    – Set to 8MHz
MHZ4    – Set to 4MHz
MHZ2    – Set to 2MHz
MHZ1    – Set to 1MHz
KHZ500    – Set to 500Khz
KHZ250    – Set to 250Khz
KHZ31    – Set to 31.5Khz


The code and include files can be found here in GitHub – https://github.com/JamieStarling/MCU_FUN/tree/master/Microchip/PIC10F322

Example blink_led_v3.c – Since we are not changing the XTAL_FREQ in the header from 8Mhz, the delays will be calculated in software for 8Mhz – thus taking the CPU to 16Mhz will make the LEDs blink twice as fast.  

#include "includes/10F322_deviceconfig.h"
#include "includes/gpio.h"
#include "includes/osc.h"

void main ()
    //Change the OSC Frequency 
    //The Forever Loop
    while (1)
        //Set PortA.0 High (turn on LED)
        //Wait 1 second
        //Set PortA.0 Low  (turn off LED)
        //Wait 1 second
        //End of Loop