8 bit LCD interface problem

General discussion on mikroBasic.
Post Reply
Author
Message
bimbla
Posts: 78
Joined: 19 Dec 2004 13:54

8 bit LCD interface problem

#1 Post by bimbla » 03 Jan 2005 14:33

I am using 18F452, 8 MHz crystal.
The LCD is connected as follows on my tutor board:
RS: RE0, EN: RE2, WR: RE1
D7 to D0: RD7 to RD0.

Accordingly I have changed the example line to:

LCD8_Config(PORTE,PORTD,0,2,1,7,6,5,4,3,2,1,0)

I have retained the rest of the program as it is.

Only squares on the 1st line appear. NOT the text message.

Kindly help.

bimbla.

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: 8 bit LCD interface problem

#2 Post by zristic » 03 Jan 2005 15:57

Have you tried the example which comes with the compiler?

bimbla
Posts: 78
Joined: 19 Dec 2004 13:54

8 bit LCD interface

#3 Post by bimbla » 04 Jan 2005 02:15

Yes, I have tried it with the example that comes with the compiler. The only line that I changed is the LCD8_Config line. The rest is retained the same.

Any suggestions are welcome.

bimbla.

Steve
Posts: 233
Joined: 19 Aug 2004 02:33
Location: North Carolina

#4 Post by Steve » 04 Jan 2005 02:46

Check the contrast pot. The first time I ever tried a LCD all I got was squares until I adjusted this pot.

bimbla
Posts: 78
Joined: 19 Dec 2004 13:54

8 bit LCD interface

#5 Post by bimbla » 04 Jan 2005 04:33

Thank you. But I have gone through the basic.
I have taken to BASIC (for PIC development) and I am determined to get all my modules working.
(Blinking alternate LED is just complete.)

bimbla.

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: 8 bit LCD interface

#6 Post by zristic » 04 Jan 2005 11:45

PORTE is a rather strange port, I would not recommend users to use it for LCD. Have you tried PORTB, PORTD combination?

bimbla
Posts: 78
Joined: 19 Dec 2004 13:54

LCD problem

#7 Post by bimbla » 05 Jan 2005 12:15

It is not all that strange. John Peatman also has done it using PORT E and PORT D. Besides it works with 'C' and should work with mikroBASIC also

Any way, since I have my hardware, can anyone post the code I should try , for my hardware config? PLEASE!

Thanks in advance.

bimbla.

bimbla
Posts: 78
Joined: 19 Dec 2004 13:54

8-bit LCD interface- Custom hardware

#8 Post by bimbla » 09 Jan 2005 09:59

Code: Select all

' This code demonstrates the use of LCD library procedures and functions for
' displaying text on LCD (8- bit intrface)
' Custom hardware config: RS--> RE0, RW--> RE1, EN--> RE2, D0 to D7--> RD0 to RD7
'******************************************************************************
program LCD8_custom_test

im Text as char[20]

main:

  ADCON1 = $07                                    ' PORT A & E as digital I/o's
  TRISE = 0                                       ' PORTE is output
  TRISD = 0                                       ' PORTD is output

  LCD8_Config(PORTE,PORTD,0,2,1,7,6,5,4,3,2,1,0)  ' Initialize LCD at PORTE and PORTD
  LCD8_Cmd(LCD_CURSOR_OFF)

  Text = "Welcome to:"
  LCD8_Out(1,1,Text)                              ' Display Text 1st ROW, 1st Col

  Text = "bimbla.com"
  LCD8_Out(2,1,Text)                              ' Display Text 2nd ROW, 1st Col

end.
Here, it was important that ADCON1 is initializes since I was using PORTE as digital I/O.

bimbla.

Post Reply

Return to “mikroBasic General”