#include <pic18f2620.h>
#pragma config WDT = OFF, OSC = INTIO67 // WDT off, int RC osc,
// RA6 & RA7 as I/O
// See 18F Config Addendum,
// p. 116
void delay(int dly)
{
while(--dly > 0)
dly = dly;
}
void main()
{
OSCCON = 0x72; // Int osc at 8 MHz
// See p. 30 of 18F2620 data sheet
ADCON1 = 0x0f; // All ports digital
// See 18F2620 data sheet, p. 94
ADCON2 = 0x05; // Set AN10-AN12 on PORTB as digital I/O
// See p. 224 of 18F2620 data sheet
TRISB = 0; // All PORTB lines as outputs
while(1)
{
PORTB = 0x55; // Flash 8 LEDs on PORTB in checkerboard pattern
delay(6500); // at approx 5 Hz
PORTB = 0xAA;
delay(6500);
}
}