Hi all
I am trying to get my LCD working on a pic 18F4520. (have tested the LCD on a 16f628 and it definitely works but only have the .hex file from years ago)
SO right now I attaching the code I have so far ...
I'm just not sure I have the code all correct.
Do I need to add things like DEFINES to change the default ports.
I would also like to use the built in clock.This is in my code, please could someone just double check it is correct.
Here is my code so far, I know it's probably very wrong but it's what I have so far.
My pinout are as follows and please see the attached diagram tooCode:OSCCON = $70 'Int CLK 8MHz OSCTUNE.6 = 1 'PLL 4x ADCON1= %00001111 '$0F = disable A/D converter TRISA = %00000000 'All pins are outputs TRISB = %00000000 TRISC = %00000000 TRISD = %00000000 TRISE.0 = 0 TRISE.1 = 0 TRISE.2 = 0 DEFINE OSC 32 '4x 8MHz Pause 500 ' Wait for LCD to startup loop1: Lcdout $fe, 1 ' Clear LCD screen Lcdout "Hello" ' Display Hello Pause 500 ' Wait .5 second Lcdout $fe, 1 ' Clear LCD screen Lcdout "World" Pause 500 ' Wait .5 second Goto loop1 ' Do it forever
1 VDD VSS
2 VSS VDD
3 VEE VEE (10k)
4 RS 21(PortD.2)
5 RW VSS
6 E 22(PortD.3)
7
8
9
10
11 D4 27(PortD.4)
12 D5 28(PortD.5)
13 D6 29(PortD.6)
14 D7 30(PortD.7)
15
16
I really would appreciate any help and suggestions.
Kind regards
Dennis





Bookmarks