/*
    
    10-15-03
    Copyright Spark Fun Electronics 2003©
    
    Classic Blinking Test Routine for the 18 Pin PIC18F1320

    Flashes all pins on PIC - 20MHz operations
    
*/

#include "d:\Pics\c\cc8e\18F452.h"  // Device dependent definitions

#pragma config[1] = 0b.0010.0010 //HS Oscillator
#pragma config[2] = 0b.0000.0000 //Brown out off, PWRT On
#pragma config[3] = 0b.0000.0000 //WDT Off
#pragma config[6] = 0b.1000.0000 //ICD Off, LVP Off, Stack Overflow Reset off

void delay_ms(uns16);

void main()
{

    PORTA = 0b.0000.0000;
    TRISA = 0b.0000.0000;  //0 = Output, 1 = Input

    PORTB = 0b.0000.0000;
    TRISB = 0b.0000.0000;  //0 = Output, 1 = Input

    while(1)
    {
        PORTA = 0x00;
        PORTB = 0xFF;
        delay_ms(1000);
        
        PORTA = 0xFF;
        PORTB = 0x00;
        delay_ms(1000);
    }

}

//General short delay
void delay_ms(uns16 x)
{
    uns8 y, z;
    for ( ; x > 0 ; x--)
        for ( y = 0 ; y < 4 ; y++)
            for ( z = 0 ; z < 176 ; z++);
}
