Does anyone know how to do this?
i read that you can set the internal oscilator to 16mhz, (osccon=0x70;) then enable the PLL to multiply by 4 giving 64mhz, (pllen=1;)
i can get it to work with 16mhz internal osc, but when i try and turn on the PLL it stops working.
In the config i have it set to INTRC port on RA6, if i try HS-PLL it doesnt work.
Any ideas
18f26k20 @ 64mhz
Re: 18f26k20 @ 64mhz
Ok, after many hours of playing i have got it running at 64mhz 
Problem is now the LCD im using (nokia LCD) wont work. it doesnt want to display anything.
Can the LCD be used at this speed? i am trying to get a faster refresh rate on the LCD.

Problem is now the LCD im using (nokia LCD) wont work. it doesnt want to display anything.
Can the LCD be used at this speed? i am trying to get a faster refresh rate on the LCD.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: 18f26k20 @ 64mhz
Hello,
I think that display it bit banged so you could try doing one of the following things.
Using the custom code feature go into the defines code section and edit this line of code.
#define MX_GFXLCD_PORT %a //portc I/O port
change to
#define MX_GFXLCD_PORT latx //portc I/O port
where x is the port letter you are using eg. lata for port a.
Try this and if this is still not working for you then you may have to try adding delays in the sendbyte function.
Here is the section that transmits the data to the display.
try changing to
I think that display it bit banged so you could try doing one of the following things.
Using the custom code feature go into the defines code section and edit this line of code.
#define MX_GFXLCD_PORT %a //portc I/O port
change to
#define MX_GFXLCD_PORT latx //portc I/O port
where x is the port letter you are using eg. lata for port a.
Try this and if this is still not working for you then you may have to try adding delays in the sendbyte function.
Here is the section that transmits the data to the display.
Code: Select all
#if MX_GFXLCD_TYPE == 0 //EB043 ONLY
char i;
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_CS); //MX_GFXLCD_CS 0 start of sequence
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_SCLK); //Clock 0
if (Command == MX_GFXLCD_CMD)
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_SDATA); //0 = MX_GFXLCD_CMD
else
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_SDATA); //1 = MX_GFXLCD_PARAMeter
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_SCLK);
for (i=0;i<8;i++)
{
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_SCLK); //Clock 0
if (Lcdout & 0x80)
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_SDATA); //Output MSB
else
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_SDATA);
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_SCLK); //Clock 1
Lcdout = Lcdout << 1; //Shift Data to left
}
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_CS); //MX_GFXLCD_CS to 1 at end of sequence
#endif
Code: Select all
#if MX_GFXLCD_TYPE == 0 //EB043 ONLY
char i;
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_CS); //MX_GFXLCD_CS 0 start of sequence
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_SCLK); //Clock 0
if (Command == MX_GFXLCD_CMD)
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_SDATA); //0 = MX_GFXLCD_CMD
else
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_SDATA); //1 = MX_GFXLCD_PARAMeter
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_SCLK);
for (i=0;i<8;i++)
{
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_SCLK); //Clock 0
delay_us(1); ///////////////////////////////////////////////delay added here
if (Lcdout & 0x80)
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_SDATA); //Output MSB
else
clear_bit(MX_GFXLCD_PORT, MX_GFXLCD_SDATA);
delay_us(1); ///////////////////////////////////////////////delay added here
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_SCLK); //Clock 1
delay_us(1); ///////////////////////////////////////////////delay added here
Lcdout = Lcdout << 1; //Shift Data to left
}
set_bit(MX_GFXLCD_PORT, MX_GFXLCD_CS); //MX_GFXLCD_CS to 1 at end of sequence
#endif
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: 18f26k20 @ 64mhz
Hi Ben
Thanks for your help, that appears to have allowed the screen to work again, but even at this speed its still slow at refreshing, when creating a full screen box, you can see it as it renders the screen, scrolling down. Is there any way to speed this up more?
Thanks for your help, that appears to have allowed the screen to work again, but even at this speed its still slow at refreshing, when creating a full screen box, you can see it as it renders the screen, scrolling down. Is there any way to speed this up more?
Re: 18f26k20 @ 64mhz
ok, so i removed the delays you added out of curiosity to see if these were slowing down the data transfer, when removed the LCD updates at a good speed, not as fast as i would like but close enough.