Page 1 of 1

18F46K22 LCD problem

Posted: Mon Feb 25, 2013 10:56 am
by Michaelt
Hello everyone.

For some time i have been working on a project regardig a Climate control box for Beer fermentation, I was using a Pic16f1937 with a standard HD44780 16x2 LCD witch was working fine, i just ran out of Program memory because of a lot of Text messages and Floating point math. and because i would like to make some temperature datalogging, later on. :D

Then i found out that i had a pic18F46k22 that i have never used, so i thaught i would give it a shot, Since the pinlayout is the same on the 2 Pics i just altered the pic to 18f46k22 and saved my project and replaced the old pic with the new one in the board i made. i altered the timer settings so that they match my old project. I can se that the program is running because of some output leds that are working correct, But i get nothing at all on the 16x2 lcd,

to test I then started a new project only with a led and a single lcd string command, but stil the same problem, led is blinking but nothing on the lcd. The LCD is wired to portC Bit 0-5

Is there a simple explanation for this behavier. I know that the 18f is more complex and has more setup options, So maybe it is me that is doing somethimg wrong.

I have attached the test program i made.
18f46k22test.fcf
(10 KiB) Downloaded 277 times
Regards Michael

Re: 18F46K22 LCD problem

Posted: Mon Feb 25, 2013 12:20 pm
by Enamul
Hi
Can you please try it now? It's not a good practice to put delay in interrupt macro.

Re: 18F46K22 LCD problem

Posted: Mon Feb 25, 2013 1:41 pm
by Michaelt
Thanks a lot for the quick response Enamul i apreciate it.

Thats seemed to fix it, i am not that experienced in programming, so everything i do is not always logical. the reason i put an interupt tmr in my main program is because i thaught the lcd display could not handle the high clock counts. is there a maximum for this??

Regards michael

Re: 18F46K22 LCD problem

Posted: Mon Feb 25, 2013 2:24 pm
by Enamul
Hi

You can easily put LCD macro in main function just ensure some delay between each refresh. Other than that 10Mhz or 20MHz clock speed is pretty normal for LCD.

Re: 18F46K22 LCD problem

Posted: Mon Feb 25, 2013 5:22 pm
by Michaelt
Thanks a lot.. so u mean to put a small delay between each lcd command macro on just 10Micruseconds???

Re: 18F46K22 LCD problem

Posted: Mon Feb 25, 2013 6:21 pm
by Enamul
Hi
In macro like cursor position, write string, print ascii etc..you don't need to put delay. But if they are in the loop...where they will be repeated. You should use delay to avoid blinking the text due to high speed re-write.

Re: 18F46K22 LCD problem

Posted: Tue Feb 26, 2013 11:55 am
by Michaelt
Thanks a lot Enamul.

This has helped me on. :D

Regards Michael

Re: 18F46K22 LCD problem

Posted: Tue Feb 26, 2013 12:50 pm
by Enamul
You are most welcome :D