PDA

View Full Version : 26K80 Configuration and Port C 0, 1



retepsnikrep
- 3rd February 2018, 09:32
I'm moving from a 2680 to 26K80.
The LCD in my 2680 code does not now work in the 26K80 code.

I know this is related to port C 0,1 and a new function in the 26K80 SOSCEL

I am trying to disable the new function and set the Port C,0,1 to digital mode as per the data sheet.
I am using the old style config layout



#CONFIG ;18F26K80 CAN Enabled
__CONFIG _CONFIG1L, _SOSCSEL_DIG_1L
__CONFIG _CONFIG1H, _FOSC_INTIO2_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2L, _PWRTEN_ON_2L & _BOREN_OFF_2L & _BORV_3_2L
__CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _MSSPMSK_MSK7_3H & _CANMX_PORTB_3H & _MCLRE_OFF_3H
__CONFIG _CONFIG4L, _STVREN_OFF_4L & _BBSIZ_BB1K_4L
__CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
__CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
__CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
__CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
__CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
__CONFIG _CONFIG7H, _EBTRB_OFF_7H
#ENDCONFIG


This compiles correctly but the PIckit2 programmer gives an error (Verification of configuration failed)

I'm obviously not doing something correctly or have missed something else.. Any ideas.

I get the assembler warning config deprecated, but I thought you could ignore that and still use the old layout..

I also have just tried the new config layout.



#CONFIG
CONFIG RETEN = OFF
CONFIG INTOSCSEL = HIGH
CONFIG SOSCSEL = DIG ; DIGITAL I/O on port C 0,1
CONFIG XINST = OFF ; Disabled
CONFIG FOSC = INTIO2
CONFIG PLLCFG = ON ; Enabled
CONFIG FCMEN = OFF ; Disabled
CONFIG IESO = OFF ; Disabled
CONFIG PWRTEN = OFF ; Disabled
CONFIG BOREN = OFF ; Enabled in hardware, SBOREN disabled
CONFIG BORV = 3 ; 1.8V
CONFIG BORPWR = ZPBORMV ; ZPBORMV instead of BORMV is selected
CONFIG WDTEN = OFF
CONFIG WDTPS = 512 ; 1:512
CONFIG CANMX = PORTB ; ECAN TX and RX pins are located on RB2 and RB3, respectively
CONFIG MSSPMSK = MSK7 ; 7 Bit address masking mode
CONFIG MCLRE = OFF
CONFIG STVREN = ON ; Enabled
CONFIG BBSIZ = BB2K ; 2K word Boot Block size
CONFIG CP0 = OFF ; Disabled
CONFIG CP1 = OFF ; Disabled
CONFIG CP2 = OFF ; Disabled
CONFIG CP3 = OFF ; Disabled
CONFIG CPB = OFF ; Disabled
CONFIG CPD = OFF ; Disabled
CONFIG WRT0 = OFF ; Disabled
CONFIG WRT1 = OFF ; Disabled
CONFIG WRT2 = OFF ; Disabled
CONFIG WRT3 = OFF ; Disabled
CONFIG WRTC = OFF ; Disabled
CONFIG WRTB = OFF ; Disabled
CONFIG WRTD = OFF ; Disabled
CONFIG EBTR0 = OFF ; Disabled
CONFIG EBTR1 = OFF ; Disabled
CONFIG EBTR2 = OFF ; Disabled
CONFIG EBTR3 = OFF ; Disabled
CONFIG EBTRB = OFF ; Disabled
#ENDCONFIG


This complies with no warnings or errors but programming the device with pickit 2 gives the same configuration verification error.
LCD still not working..

retepsnikrep
- 4th February 2018, 09:39
It is now displaying stuff on the screen but all garbled and it feels like the clock is running at the wrong speed.



DEFINE OSC 32 '8mhz Clock (x4 = 32mhz) Note max speed is 64mhz..
OSCCON = %01100010 'Internal 8 mhz Osc and stable
OSCCON2 = %00000000
OSCTUNE = %01000000 'Enable PLL 8mhz x 4 = 32mhz


It should be running at 32mhz :?

retepsnikrep
- 4th February 2018, 17:16
Apologies. Operator error.
Just realised the 18F26K80 is not pin compatible with the 18F2680.
It has extra power pins and requires extra decoupling caps blah blah..
Never assume anything.. This explains why it wasn't working in my 18F2680 pcb...

retepsnikrep
- 15th May 2020, 19:54
Actually I was wrong again it is pin compatible and working ok now.

towlerg
- 16th May 2020, 12:47
You appear to be having a fine old chat with yourself there retpsnikrep.

Acetronics2
- 16th May 2020, 14:11
8852

was a moment we had not seen that one ...

Good ol' times far away ...

:rolleyes:

Alain

Ioannis
- 16th May 2020, 14:44
It took 2 year for the pin compatibility!

Good you are on-track again!

Ioannis

retepsnikrep
- 17th May 2020, 04:35
It all went on the back burner and I changed tack after I originally misread 26k80 FM. :)

I reread it recently and established my incompetence so I resurrected the original project.

Thanks for the tips..