[SOLVED] Issue with PIC18F45K22 INTOSC/PLL with LCD

General discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
FRM
Posts: 381
Joined: 20 May 2005 18:58
Location: UK

[SOLVED] Issue with PIC18F45K22 INTOSC/PLL with LCD

#1 Post by FRM » 08 Jan 2015 18:12

Hi all,

Having migrated a project to 18F45K22 so that I can run INTOSC with CLKOUT at 8MHz & PLL enabled (32MHz fosc), I'm having issues.

With the PLL enabled & project target set to 32MHz, the LCD commands do not translate correctly. If I disable PLL, set the project to 8MHz then all is well.

Previously, project was ok running on 18F452 with HS@32MHz & no changes to hardware since.

My suspicion lies with the lib timings for driving LCD. I've not had the opportunity to 'scope the drive yet.

Anyone had a similar issue?

Project files attached below as zip. Using latest mP Pro & EasyPic v.7.

Thanks!
18F45k22_PLL Test Project.zip
(33.31 KiB) Downloaded 148 times
Last edited by FRM on 09 Jan 2015 10:37, edited 1 time in total.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Issue with PIC18F45K22 INTOSC/PLL with LCD

#2 Post by janni » 09 Jan 2015 01:06

Try to use LATD rather than PORTD.

Code: Select all

  LCD_RS : sbit at LATD0_bit;
  LCD_EN : sbit at LATD1_bit;
  LCD_D4 : sbit at LATD2_bit;
  LCD_D5 : sbit at LATD3_bit;
  LCD_D6 : sbit at LATD4_bit;
  LCD_D7 : sbit at LATD5_bit;
To avoid the RMW effects one should always use LATx registers when manipulating single output pins (in processors that have LATx registers, naturally). That you haven't had problems earlier only means that load capacitances of LCD connections are small in your circuit, but RMW effects are more pronounced in newer PICs so you've finally stumbled on them at high enough clock frequency.

FRM
Posts: 381
Joined: 20 May 2005 18:58
Location: UK

Re: Issue with PIC18F45K22 INTOSC/PLL with LCD

#3 Post by FRM » 09 Jan 2015 08:34

Hi Janni,

Many thanks for the clear explanation, I completely overlooked the LCD init variables being port referenced! :oops: I normally use LAT registers to manipulate the 18F+ series in my own code
for the reason you gave, but I have to admit I completely glossed over this one! :roll:

All the best,

Frankie

Post Reply

Return to “mikroPascal PRO for PIC General”