/*
    02/05/03
    Copyright Spark Fun Electronics© 2003
    
    Blink on PIC12F675
    
    Flashes all pins on PIC - 4MHz operations
    
*/

#include "d:\Pics\c\12F675.h"  // device dependent definitions

#pragma config |= 0x0184 
//Watch dog off, Power Up Timer on, Code Protect off, MCLR pin disabled - used as general IO
//Internal 4MHz Osc with pin used at general IO
//To change the config word for your desired setup, start ICProg and set options (Check boxes, etc). 
//Then change the above 0x0184 to the 'Config Word: xxxxh' shown in the ICProg screen.

void delay_ms(uns16);

//Start main - this is the very first stuff the PIC will run
void main()
{
    GPIO = 0b.1111.1111;
    TRISIO = 0b.0000.0000;  //0 = Output, 1 = Input

    //The analog and compare modules are turned on by default
    CM2 = 1; CM1 = 1; CM0 = 1;//These turn the input pins back to digital I/O
    ANSEL = 0; //Turn off ADC on the 12F675 - All pins digital

    //Classic while loop, loops forever
    while(1)
    {

        //GPIO port to low
        GPIO = 0x00;
        delay_ms(1000);

        //GPIO port to high
        GPIO = 0xFF;
        delay_ms(1000);
        
    }

    
} //End Main

//General short delay
void delay_ms(uns16 x)
{
    uns8 y;
    for ( ; x > 0 ; x--)
        for ( y = 0 ; y < 108 ; y++);
}