After searching the forum for 2x16 I still can't see what my problem is. I have a 2x16 lcd connected to a 16f877a and it only displays solid boxes on the first row. The code I'm using works fine on my Lab-x1 with the 2x20 lcd and I've wired the 2x16 to the 16f877a the same way it is on the Lab-x1. This is the datasheet for the 2x16 i'm using http://www.lcdmk.com/product/zfx/RT162-7.PDF . I think there is something in the DEFINE's that I need to change for this particular display just not sure what. Also pretty sure I've got the BL and the contrast set to readable levels using a couple resistors.
here's my code
The attached file is basically how I have it wired. Does not show the resistors on the bl and contrast.Code:CLEAR ;Define LCD registers and control bits
DEFINE OSC 4 ;System speed
DEFINE LCD_DREG PORTD ;data register
DEFINE LCD_BITS 4 ;width of data path
DEFINE LCD_DBIT 4 ;data starts on bit 4
DEFINE LCD_RSREG PORTE ;select register
DEFINE LCD_RSBIT 0 ;select bit
DEFINE LCD_EREG PORTE ;enable register
DEFINE LCD_EBIT 1 ;enable bit
DEFINE LCD_RWREG PORTE ;read/write register
DEFINE LCD_RWBIT 2 ;read/write bit
LOW PORTE.2 ;LCD R/W low (write) We will do no reading
DEFINE LCD_LINES 2 ;lines in display
DEFINE LCD_COMMANDUS 2000 ;delay in micro seconds
DEFINE LCD_DATAUS 20 ;delay in micro seconds
;
;Set the port directions. We are setting (must set) all of PORTD and all of PORTE as outputs
;even though PORTE has only 3 lines. The other 5 lines will be ignored by the system.
;
TRISD = %00000000 ; set all PORTD lines to output
TRISE = %00000000 ; set all PORTE lines to output
; Set the Analog to Digital control register
ADCON1=%00000111 ; needed for the 16F877A see note above and below
;
LOOP: ; The main loop of the program
LCDOUT $FE, 1 ; clear screen
PAUSE 500 ; pause 0.25 seconds
LCDOUT "HELLO" ; print
LCDOUT $FE, $C0 ; goto second line, first position
LCDOUT "WORLD" ; print
PAUSE 250 ; pause 0.25 seconds
GOTO LOOP ; repeat
END ; always end all programs with an END statement
Suggestions anyone?