sorry. I'm editing the format now.
Each line has its own address in the HD44780.
Line 1 = $80
Line 2 = $C0
Line 3 = $90
Line 4 = $D0
You would need RS = 0 to send a command and send your line address, then RS = 1 and send the string.
I'm sorry. I'm not following. I think I understand how to move the cursor around. But what is RS? The register select bit? I'm not getting it to display anything even on lines 1 and 2. What would you do differently here to get it to display "hello" on line 1 and then "world" on line 2?
Code:Lcdout $fe, 1 ' Clear screen Pause 500 ' Wait .5 second Lcdout "Hello" ' Display "Hello" Pause 500 ' Wait .5 second Lcdout $fe, $c0, "World" ' Move to line 2 and display "World" Pause 500 ' Wait .5 second
the $FE,$80 is tolally unnecessary , the $FE,1 not only clears the screen it homes the cursor toLCDOUT $FE,1
lcdout $FE,$80,"Hello"
line 1 pos 0 too
is a waste of code space and indicates that the power on lcd wait may be too shortLCDOUT $FE,1:FLAGS=0:PAUSE 250:LCDOUT $FE,1:PAUSE 250 ' Initialize LCD
Pause xxx ' Wait for LCD to start up
LCDOUT $FE,1
is adequate , I have had displays that need the pause xxx to be as long as 500mS
its also possible that the default config settings in your pic16f887.inc file don't match your setup
can you blink a led at defined rate correctly ?
Last edited by richard; - 22nd February 2018 at 23:23.
Warning I'm not a teacher
I added the address for good measure. No luck. I increased the start up wait time. No luck still. I added a blinking LED and that works - on for half a second, off for 1 second. Stuff highlighted in RED is what was added/changed.
Code:TRISB = %00000000 pause 500 mainloop: Lcdout $fe, 1 ' Clear screen Pause 500 ' Wait .5 second Lcdout $fe, $80, "Hello" ' Display "Hello" PORTB.7 = 1 'LED on Pause 500 ' Wait .5 second Lcdout $fe, $c0, "World" ' Move to line 2 and display "World" PORTB.7 = 0 'LED off Pause 500 ' Wait .5 second Goto mainloop ' Do it forever End
wiring ?
contrast setting ?
unused data pins on lcd are grounded not left floating ?
Warning I'm not a teacher
The following code works for me with a 4 x 20 LCD
Obviously change the port/pin assignments to match your hardwareCode:;----[LCD ]--------------------------------------------------------------------- DEFINE LCD_DREG PORTB ' LCD Data port DEFINE LCD_DBIT 0 ' starting Data bit (0 or 4) DEFINE LCD_EREG PORTB ' LCD Enable port DEFINE LCD_EBIT 5 ' Enable bit (on EasyPIC 5 LCD) DEFINE LCD_RSREG PORTB ' LCD Register Select port DEFINE LCD_RSBIT 4 ' Register Select bit (on EasyPIC 5 LCD) DEFINE LCD_BITS 4 ' LCD bus size (4 or 8 bits) DEFINE LCD_LINES 4 ' number of lines on LCD DEFINE LCD_COMMANDUS 2000 ' Command delay time in us DEFINE LCD_DATAUS 50 ' Data delay time in us LCDOUT $FE,1:FLAGS=0:PAUSE 250:LCDOUT $FE,1:PAUSE 250 ' Initialize LCD
To inform the LCD which line to start displaying text on use;
Code:$fe,$80, $fe,$C0, $fe,$94, $fe,$d4,
Bookmarks