
Originally Posted by
bugi
Hi everybody,
I live a problem with 18f26k20.
My codes working perfect with 18f46k20. I use serial CLCD with Pll 16x4=64 Mhz. (also all xtal freq.)
I init the lcd and send data or command with 4 pins and I don't use any spi or other command.
I use 1 or 0 with port and pin name. (ex. Portb.1=0 faster than the shiftout )
But 18f26k20 drives the same lcd only with 4-8-12-16 Mhz or 4Mhz with pll=16 Mhz. It doesn't work faster than 16 Mhz. (32 or 64 Mhz.) Pic works all speed also 32 or 64 Mhz but can not drive or init this LCd. I have changed the old pic with a new one but the result is the same. I'm going crazy...
Are there any factory defect or what can it be ? I use soic package.
Best Regards.
Bugra
This is what I arrived at.
Norm
Code:
Device = 18F26K20
Config_Start
' FOSC = HS ; HS oscillator
' FOSC = HSPLL ; HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)
FOSC = INTIO67 ; INTERNAL OSCILLATOR .PORTA.6 AND 7 I/O's
FCMEN = OFF ; Fail-Safe Clock Monitor disabled
IESO = OFF ; Oscillator Switchover mode disabled
PWRT = On ; PWRT enabled
BOREN = On ; Brown-out Reset enabled and controlled by software (SBOREN is enabled)
BORV = 27 ; VBOR set to 2.7 V nominal
WDTEN = OFF ; WDT is controlled by SWDTEN bit of the WDTCON register
MCLRE = On ; MCLR pin enabled, RE3 input pin disabled
HFOFST = OFF ; The system clock is held off until the HF-INTOSC is stable.
LPT1OSC = OFF ; Disabled, T1 operates in standard power mode.
PBADEN = OFF ; PORTB<4:0> pins are configured as digital I/O on Reset
STVREN = On ; Stack full/underflow will cause Reset
LVP = OFF ; Single-Supply ICSP disabled
XINST = OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
Debug = OFF ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
CP0 = OFF ; Block 0 (000800-003FFFh) not code-protected
CP1 = OFF ; Block 1 (004000-007FFFh) not code-protected
CP2 = OFF ; Block 2 (008000-00BFFFh) not code-protected
CP3 = OFF ; Block 3 (00C000-00FFFFh) not code-protected
CPB = OFF ; Boot block (000000-0007FFh) not code-protected
CPD = OFF ; Data EEPROM not code-protected
WRT0 = OFF ; Block 0 (000800-003FFFh) not write-protected
WRT1 = OFF ; Block 1 (004000-007FFFh) not write-protected
WRT2 = OFF ; Block 2 (008000-00BFFFh) not write-protected
WRT3 = OFF ; Block 3 (00C000-00FFFFh) not write-protected
WRTB = OFF ; Boot block (000000-0007FFh) not write-protected
WRTC = OFF ; Configuration registers (300000-3000FFh) not write-protected
WRTD = OFF ; Data EEPROM not write-protected
EBTR0 = OFF ; Block 0 (000800-003FFFh) not protected from table reads executed in other blocks
EBTR1 = OFF ; Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
EBTR2 = OFF ; Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
EBTR3 = OFF ; Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks
EBTRB = OFF ; Boot block (000000-0007FFh) not protected from table reads executed in other blocks
Config_End
' XTAL = 64 ' REQUIRES PLL ' USE 16 MHz CRYSTAL & DECLARE: XTAL = 64
' XTAL = 48 ' REQUIRES PLL ' USE 12 MHz CRYSTAL & DECLARE: XTAL = 48
' Xtal = 40 ' REQUIRES PLL ' USE 10 MHz CRYSTAL & DECLARE: XTAL = 40
' Xtal = 20
XTAL = 16 'INTERNAL OSCILLATOR MUST BE 8 OR 16 FOR PLL, CONFIGURE OSCCON AND OSCTUNE FOR PLL
'UNCOMMENT FOR INTERNAL ONLY
OSCCON = %01110110 'INTERNAL OSCILLATOR
OSCTUNE = %01000000 '%x1xxxxxx = PLL ENABLED MUST BE 8 OR 16MHz IN OSCCON FOR PLL