Having never used any 18F chips I'm after an example config section of code to have a look at before I try to migrate my code to the new pic.
My current 16F886 config looks like this
My 16F886 defines look like the below any obvious issues with those and 18F2620 pic. It should be pin compatible I believe.Code:#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
Thanks PeterCode: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 DEFINE LCD_DREG PORTB 'PORTB is LCD data port DEFINE LCD_DBIT 0 'PORTB.0 is the data LSB DEFINE LCD_RSREG PORTC 'RS is connected to PORTC.0 DEFINE LCD_RSBIT 0 DEFINE LCD_EREG PORTC 'EN is connected to PORTC.1 DEFINE LCD_EBIT 1 DEFINE LCD_BITS 8 '8 lines of data are used DEFINE LCD_LINES 4 'It is a 4-line display DEFINE LCD_COMMANDUS 2000 'Use 2000uS command delay DEFINE LCD_DATAUS 50 'Use 50uS data delay DEFINE ADC_BITS 8 'Set number of bits in result DEFINE ADC_CLOCK 3 'Set Clock source (3 = rc) DEFINE ADC_SAMPLEUS 50 'Set sampling time in uS DEFINE CCP1_REG PORTC 'HPWM channel 1 pin Port C Backlight PWM Driver DEFINE CCP1_BIT 2 'HPWM channel 1 pin Bit 2




Bookmarks