here is commented config for 18f67k22 , 64mhz internal
Code:
' config for 18F67K22
#CONFIG
;----- CONFIG1L Options --------------------------------------------------
CONFIG XINST = OFF
CONFIG SOSCSEL = DIG ; Digital (SCLKI) mode; I/O port functionality of RC0 and RC1 is enabled
CONFIG INTOSCSEL = HIGH ; LF-INTOSC in High-power mode during Sleep
CONFIG RETEN = ON
;----- CONFIG1H Options --------------------------------------------------
CONFIG IESO = OFF
CONFIG FCMEN = OFF
CONFIG PLLCFG = ON
CONFIG FOSC = INTIO2 ; Internal RC oscillator
;----- CONFIG2L Options --------------------------------------------------
CONFIG BORPWR = ZPBORMV ; ZPBORMV instead of BORMV is selected
CONFIG BORV = 2 ; 2V
CONFIG BOREN = SBORDIS ; Enabled in hardware, SBOREN disabled
CONFIG PWRTEN = ON ; Power up timer on
;----- CONFIG2H Options --------------------------------------------------
CONFIG WDTPS = 512 ; 1:512
CONFIG WDTEN = ON ; WDT ON
;----- CONFIG3L Options --------------------------------------------------
CONFIG RTCOSC = INTOSCREF ; RTCC uses internal osc
;----- CONFIG3H Options --------------------------------------------------
CONFIG MCLRE = ON ; MCLR Enabled, RG5 disabled
CONFIG MSSPMSK = MSK7 ; 7 Bit address masking mode
CONFIG CCP2MX = PORTC ; RC1
;----- CONFIG4L Options --------------------------------------------------
CONFIG DEBUG = OFF
CONFIG BBSIZ = BB1K ; 1K word Boot Block size
CONFIG STVREN = ON
;----- CONFIG5L Options --------------------------------------------------
CONFIG CP0 = OFF
CONFIG CP1 = OFF
CONFIG CP2 = OFF
CONFIG CP3 = OFF
CONFIG CP4 = OFF
CONFIG CP5 = OFF
CONFIG CP6 = OFF
CONFIG CP7 = OFF
;----- CONFIG5H Options --------------------------------------------------
CONFIG CPD = OFF
CONFIG CPB = OFF
;----- CONFIG6L Options --------------------------------------------------
CONFIG WRT0 = OFF
CONFIG WRT1 = OFF
CONFIG WRT2 = OFF
CONFIG WRT3 = OFF
CONFIG WRT4 = OFF
CONFIG WRT5 = OFF
CONFIG WRT6 = OFF
CONFIG WRT7 = OFF
;----- CONFIG6H Options --------------------------------------------------
CONFIG WRTD = OFF
CONFIG WRTB = OFF
CONFIG WRTC = OFF
;----- CONFIG7L Options --------------------------------------------------
CONFIG EBRT0 = OFF
CONFIG EBRT1 = OFF
CONFIG EBRT2 = OFF
CONFIG EBRT3 = OFF
CONFIG EBRT4 = OFF
CONFIG EBRT5 = OFF
CONFIG EBRT6 = OFF
CONFIG EBRT7 = OFF
;----- CONFIG7H Options --------------------------------------------------
CONFIG EBRTB = OFF
#ENDCONFIG
usually the problems are with C port or D port as config affects use of those ports
Code:
' ------- Setup port B Variables & directions ----------
INTCON2.7 = 0 ' Weak Pullups Globle PortB - 1= globel PortB disable, 0 = PortB Globle enable
INTCON2.0 = 1 ' RBIP - RB PortB Change Interupt Priority - 1 = High Priorty , 0 = Low Priority
TRISB = %11011111 ' setup Port B input=1,output=0 for I/O pins
PORTB = %00000000 ' Clear Outputs
Bookmarks