/******************************************************************** * FileName: light countdown.c * Processor: PIC18F4520 * Compiler: MPLAB C18 v.3.06 * * This file flashs the lights on the PICDEM 2 Board * * You modify to countdown from 12 to 0 @ 0.5 second intervals * * Author Date Comment *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ // (Your name here) /** Processor Header Files ****************************************/ #include #include // === Configuration Bits ======================================= // #pragma config OSC = EC // External 4MHz crystal for PICDEM board only #pragma config WDT = OFF #pragma config LVP = OFF #pragma config BOREN = OFF #pragma config XINST = OFF /***************************************************************** * Function: void main(void) ******************************************************************/ #pragma code void main (void) { ADCON1 = 0b00001111; // Sets all the pins to digital TRISB = 0b00000000; // Sets all the dital PORTB pins to outputs while (1) { PORTB = 0b0001; // Light RB0 Delay10KTCYx(200); // Delay for 2 seconds PORTB = 0b1000; // Light RB3 Delay10KTCYx(200); // Delay for 2 seconds } }