Continue to Site

How to write a code for a generic 4x20 character LCD ?

Status
Not open for further replies.

jojokatada

Full Member level 5
Full Member level 5
Joined
Jan 13, 2005
Messages
255
Helped
19
Reputation
38
Reaction score
4
Trophy points
1,298
Activity points
2,122
LCD 4 X20 character

hi could anybody help me on how to write a code for a generic 4 line and 20 character LCD? i am connected with pic16f84a using 4bit data bus, using picbasic pro compiler

sample code


main:
pause 1

lcdout $fe,1," Hello world", $fe,c0," hello again" ,fe,94,"welcome" fe,d4,"thank you"

goto main

end

the compiler give me some error messages
 

LCD 4 X20 character

use help
 

Re: LCD 4 X20 character

i did you the help by moving the cursor the the instruction and press F1 but the sample gave me was 2 X16 lcd, i don't know what are the different between the 4x20 and 2x16.
 

Re: LCD 4 X20 character

You should use this:
lcdout $fe,1," Hello world", $fe,$c0," hello again" ,$fe,$94,"welcome",$fe,$d4,"thank you"
...don't forget '$fe' when you send commands, and '$' if there are hex numbers...
 

Re: LCD 4 X20 character

hi appreciate for the help but in my program i did include the $size but it stil error
 

Re: LCD 4 X20 character

jojokatada said:
lcdout $fe,1," Hello world", $fe,c0," hello again" ,fe,94,"welcome" fe,d4,"thank you"
the compiler give me some error messages

No, you didn't included $ and one comma after "welcome"
Try to copy this one in your program:
lcdout $fe,1," Hello world", $fe,$c0," hello again",$fe,$94,"welcome",$fe,$d4,"thank you"
I have just tested it and works ok, no compiler errors.
 

Re: LCD 4 X20 character

ok this is my code

'display message on the 4 X 20 character LCD

DEFINE LCD_DREG PORTA 'LCD data port
DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTA 'LCD register select port
DEFINE LCD_RSBIT 4 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 3 'LCD enable bit
DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 4 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time
main:
pause 500

lcdout $fe,1," Hello world", $fe,$c0," hello again", $fe,$94," welcome",$ $fe,$d4,"thank you"

' it is in oneline only
goto main
end

i got an error message please see at the attachment
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top