16x1 lcd two wire setup problem

louislouis

New Member
Hello,
I have a problem with correct initialization and displaying characters on 16x1 lcd.
I use two wire setup 74ls164 shift register and PICAXE 08M2.
The display driver chip is HD44780A00.
If I try to send to the lcd "testtesttesttest" display show only first eight letters like "testtest"
Can anyone help me solve this problem? Thanks.

The source code which I use is bellow:
Code:
SYMBOL DAT = 1 ; Pin number of DAT line
SYMBOL CLK = 0 ; Pin number of CLK line
SYMBOL DAT_PIN = pin1 ; Pin number of DAT line
SYMBOL CLK_PULSE_LENGTH = 1 ; 10uS
SYMBOL E_PULSE_LENGTH = 1 ; 10uS
SYMBOL RSCMDmask = %00000000 ; Select Command register
SYMBOL RSDATmask = %00001000 ; Select Data register
SYMBOL aget = b9
SYMBOL outbyte = b10
SYMBOL dataOut = b11
SYMBOL bitNumber = b12
SYMBOL rsbit = b13


PowerOnReset:
GOSUB InitialiseLcd ;Init LCD SCREEN
Main:
for b2=1 to 4
lookup b1,("tes"),outbyte ; LOOKUP THE LETTER AND SEND IT TO THE LCD SCREEN
outbyte = "t"		
gosub SendDataByte
outbyte = "e"		
gosub SendDataByte
outbyte = "s"		
gosub SendDataByte
outbyte = "t"		
gosub SendDataByte
next b2
end
		    
InitialiseLcd:
FOR aget = 0 TO 5
READ aget,outbyte
GOSUB SendInitCmdByte
NEXT
' Nibble commands - To initialise 4-bit mode
EEPROM 0,( $33 ) ; %001?---- %001L---- Display Format
EEPROM 1,( $32 )
' Byte commands - To configure the LCD
EEPROM 2,( $20 ) ; %00100000 %001LNF00 one line Display Format
EEPROM 3,( $0C ) ; %00001100 %00001DCB Display On
EEPROM 4,( $06 ) ; %00000110 %000001IS Cursor Move
EEPROM 5,( $01 ) ; Clear Screen
RETURN

SendInitCmdByte:
PAUSE 15 ; Delay 15mS

SendCmdByte:
rsbit = RSCMDmask ; Send to Command register

SendDataByte:
dataOut = outbyte & %11110000 | rsbit 
GOSUB TransferTo74LS164
dataOut = outbyte * %00010000 | rsbit
GOSUB TransferTo74LS164
rsbit = RSDATmask ; Send to Data register next
RETURN

TransferTo74LS164:
LOW DAT ; Clear 74LS164
FOR bitNumber = 0 TO 7
PULSOUT CLK,CLK_PULSE_LENGTH
NEXT
HIGH DAT ; Transfer data
PULSOUT CLK,CLK_PULSE_LENGTH
FOR bitNumber = 0 TO 6
DAT_PIN = dataOut / $80
PULSOUT CLK,CLK_PULSE_LENGTH
dataOut = dataOut * 2
NEXT
PULSOUT DAT,E_PULSE_LENGTH ; Pulse E
RETURN ; Completed transfer
 

hippy

Ex-Staff (retired)
A 16x1 LCD is usually configured as an 8x2 LCD but with the lines concatenated rather than separate. You need to move the cursor to the second line after displaying 8 bytes. Untested but something like ...

Code:
Main:
  For b1 = 0 To 7
    LookUp b1, ( "12345678" ), outbyte
    Gosub SendDataByte
  Next

  outbyte = $C0 : SendCmdByte

  For b1 = 0 To 7
    LookUp b1, ( "ABCDEFGH" ), outbyte
    Gosub SendDataByte
  Next

  Do : Loop
 

louislouis

New Member
Thanks Hippy, it works!
First mistake what I made is cursor on wrong place.
The second mistake what I made is initialize the 16x1 lcd in one line. Right way is two line like a 16x2 lcd (8x2).
Perfect, thanks.
 
Top