Device = 18F87K22 Config_Start RETEN = OFF ; Disabled - Controlled by SRETEN bit SOSCSEL = Low ; Low Power SOSC circuit selected XINST = OFF ; Disabled FOSC = INTIO2 ; Internal RC oscillator PLLCFG = On ; Disabled FCMEN = OFF ; Disabled IESO = OFF ; Disabled WDTEN = OFF ; WDT disabled in hardware; SWDTEN bit disabled RTCOSC = SOSCREF ; RTCC uses SOSC EASHFT = OFF ; Address shifting disabled Wait = OFF ; Disabled CCP2MX = PORTC ; RC1 ECCPMX = PORTE ; Enhanced CCP1/3 [P1B/P1C/P3B/P3C] muxed with RE6/RE5/RE4/RE3 MCLRE = Off ; MCLR Enabled, RG5 Disabled STVREN = OFF ; Disabled Config_End OSCCON = %01111100 '|Default primary oscillator (OSC1/OSC2 or HF-INTOSC with or without PLL OSCTUNE = %11011111 '|Maximum frequency 16mhz + PLL TRISA = %00000111 TRISB = %00001111 TRISC = %00000000 TRISD = %00000000 TRISE = %01000000 TRISF = %11110000 TRISG = %00001100 TRISH = %10011111 TRISJ = %11100000 ANCON2 = %000000000 'portG ANCON0 = %00000111 '|AN0-AN7 Setting these registers makes the corresponding pins '|analog and clearing the registers makes the ports digital. ANCON1 = %01010010 '|AN8-AN15 Setting these registers makes the corresponding pins '|analog and clearing the registers makes the ports digital. ANCON2 = %01010010 '|AN16-AN23 Setting these registers makes the corresponding pins '|analog and clearing the registers makes the ports digital. ADCON0 = %01011000 '| Symbol ADON = ADCON0.0 Symbol GO_DONE = ADCON0.1 ADCON1 = %00000000 ADCON2 = %10110110 PADCFG1=%00001110