NHD-0220GZ-FSW-GBW-L
I have installed this display for 4-bit mode and am using PicBasic Pro. I have used various similar character displays in the past without issue with PB Pro. This is my first experience with Newhaven. I have had some success getting characters on line 1, but nothing ever on line 2. I found the PicBasic sample code and gave that a try with the appropriate port and bit changes in the DEFINEs. This does not work either. After some delay, I get an underline cursor and a flashing block cursor at the beginning of line 1. That's it.
The pic processor is PIC18F26K22.
Here is a copy of the test code -
'================= ' 2x8 LCD display
' LCD DEFINES FOR USING 2x8 LCD with PortC
DEFINE LCD_DREG PORTC ' Use PORTC for LCD Data
DEFINE LCD_DBIT 0 ' Use lower(4) 4 bits of PORTC
' PORTC.0 thru PORTC.3 connect to
' LCD DB4 thru LCD DB-7 respectively
DEFINE LCD_RSREG PORTC ' PORTC for RegisterSelect (RS) bit
DEFINE LCD_RSBIT 4 ' PORTC.4 pin for LCD's RS line
DEFINE LCD_RWREG PORTC ' LCD read/write port
DEFINE LCD_RWBIT 5 ' LCD read/write bit
DEFINE LCD_EREG PORTC ' PORTC for Enable (E) bit
DEFINE LCD_EBIT 6 ' PORTC.5 pin for LCD's E line
DEFINE LCD_BITS 4 ' Using 4-bit bus
DEFINE LCD_LINES 2 ' Using 2 line Display
DEFINE LCD_COMMANDUS 10000' Command Delay (uS)
DEFINE LCD_DATAUS 100 ' Data Delay (uS)
' DEFINE LCD Control Constants
Line1 CON 128 ' Point to beginning of line 1 ($80)
Line2 CON 192 ' Point to beginning of line 2 ($C0)
' Test the LCD during initialization
LCDOut $fe,1:FLAGS=0:Pause 250 ' Clear Display
LCDOut $fe,Line1,"LCD TEST" ' Display on 1st line
Pause 500
LCDOut $fe,Line2,"Power On!" ' Display on 2nd line
PAUSE 1000
end
The following code will display LCD on line one starting at the first character position. If I leave out the starting space, I get nothing. If I use LCDOUT $fe, $80, " LCD", I get nothing.
Pause 100 ' Wait for LCD to start up
lcdout $fe, 1
lcdout $fe, $0c
Lcdout $fe, 1 ' Clear screen
pause 500
LCDOUT $fe, " LCD"
I have rechecked my pc board wiring over and over and can't find any error.
Any help is much appreciated. Thanks.
-
A couple of differences I noticed:
Our example code is using a different port for read/write, whereas your code is using the same port for all signals.
There is a mismatch in your line: "DEFINE LCD_EBIT 6 ' PORTC.5 pin for LCD's E line"0 -
I am still completely puzzled by this. I have substituted another display from another manufacturer and it works perfectly. It does happen to be a 2 x 16 display.
0
Please sign in to leave a comment.
Comments
2 comments