Thanks for the guidance here is my new 18F2620 config.
Code:
'------------------------------ New General 18F2620 configuration --------------------------
'#CONFIG
' __CONFIG _CONFIG1H, _OSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
' __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOREN_OFF_2L
' __CONFIG _CONFIG2H, _WDT_OFF_2H
' __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_OFF_3H
' __CONFIG _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
'#ENDCONFIG
'DEFINE OSC 8 'Set PicBasic Pro processor speed to 8 Mhz
'OSCCON = %01110110 'Internal 8 mhz Osc and stable
'CMCON = %00000111 'Comparators Off
'T1CON = %00110000 '$30 = Prescaler 1:8, TMR1 OFF
'TRISA = %00001011 'SET PORTA0, A1 & A3 AS INPUTS, REST AS OUTPUTS
'TRISB = %00000000 'SET PORTB AS OUTPUTS
'TRISC = %10010000 'SET PORTC AS OUTPUTS EXCEPT PORT C4 & C7
'ADCON0 = %00000001 'SETUP ADC & ENABLE ADC MODULE on AD0
'ADCON1 = %00001110 'SETUP ADC SET REFV to VDD & VSS AN0
'ADCON2 = %00100010 'SETUP ADC FOSC/32 LEFT JUSTIFY TAD 8
Below is my working old 16F886 config. Any glaring errors in the above? I'm just swapping chips and I want all functions to remain the same.
Code:
'------------------------------ General 16F886 configuration --------------------------
#CONFIG
__CONFIG _CONFIG1, _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDT_OFF &
_INTRC_OSC_NOCLKOUT
__CONFIG _CONFIG2, _WRT_OFF & _BOR21V
#ENDCONFIG
DEFINE OSC 8 'Set PicBasic Pro processor speed to 8 Mhz
OSCCON = %01110101 'Internal 8 mhz Osc and stable
CM1CON0 = 0 'Comparator Off
CM2CON0 = 0 'Comparator Off
T1CON = %00110000 '$30 = Prescaler 1:8, TMR1 OFF
TRISA = %00001011 'SET PORTA0, A1 & A3 AS INPUTS, REST AS OUTPUTS
TRISB = %00000000 'SET PORTB AS OUTPUTS
TRISC = %10010000 'SET PORTC AS OUTPUTS EXCEPT PORT C4 & C7
ANSEL = %00000001 'SET INPUT AN0 AS ANALOG INPUT
ANSELH = %00000000 'Disable PortB AD
ADCON0 = %10000001 'SETUP ADC CONVERTER MODULE FOSC/32 & ENABLE ADC MODULE on AD0
ADCON1 = %00000000 'SETUP ADC LEFT JUSTIFY SET REFV to VDD & VSS
Thanks Peter
Bookmarks