Hello, I'm new in this forum and I have a problem with the inicialitzacion of a graphic lcd (powertip 128x64). The code that I use follows the instructions that toshiba says in his datasheet (the datasheet of the controller). This is what i've done:
INIT_LCD
BSF PORTD,RST
BSF PORTD,LCD_WR
BSF PORTD,LCD_RD
BSF PORTD,CD
BCF PORTD,RST
MOVLW 0xff
CALL X_DELAY500
MOVLW 0xff
CALL X_DELAY500
MOVLW 0xff
CALL X_DELAY500
MOVLW 0xff
CALL X_DELAY500
MOVLW 0xff
CALL X_DELAY500
MOVLW 0xff
CALL X_DELAY500
MOVLW 0xff
CALL X_DELAY500
BSF PORTD,RST
BCF PORTD,CD;text home addres set
BCF PORTD,LCD_WR
MOVLW 0x00
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,LCD_WR
MOVLW 0x00
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BSF PORTD,CD
BCF PORTD,LCD_WR
MOVLW 0x42
MOVWF PORTB
BSF PORTD,LCD_WR
BCF PORTD,CD
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,CD;text area set command
BCF PORTD,LCD_WR
MOVLW 0x10
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,LCD_WR
MOVLW 0x00
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BSF PORTD,CD
BCF PORTD,LCD_WR
MOVLW 0x43
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,CD;ADDRES POINTER SET COMMAND
BCF PORTD,LCD_WR
MOVLW 0x00
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,LCD_WR
MOVLW 0x08
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BSF PORTD,CD
BCF PORTD,LCD_WR
MOVLW 0x40
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,CD;SET TEXT AREA SET
BCF PORTD,LCD_WR
MOVLW 0x10
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,LCD_WR
MOVLW 0x00
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BSF PORTD,CD
BCF PORTD,LCD_WR
MOVLW 0x41
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BSF PORTD,CD;mode set
BCF PORTD,LCD_WR
MOVLW 0x80
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
MOVLW 0xff
CALL X_DELAY500
BSF PORTD,CD
BCF PORTD,LCD_WR
MOVLW 0x9E
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,CD
BCF PORTD,LCD_WR
MOVLW 0x23
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,LCD_WR
MOVLW 0x01
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BSF PORTD,CD
BCF PORTD,LCD_WR
MOVLW 0x24
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
BCF PORTD,CD
BCF PORTD,LCD_WR
MOVLW 0x21
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
MOVLW 0xff
CALL X_DELAY500
BSF PORTD,CD
BCF PORTD,LCD_WR
MOVLW 0xC0
MOVWF PORTB
BSF PORTD,LCD_WR
MOVLW 0xff
CALL X_DELAY500
RETURN
I use a pic 16f877. In the display only appears a line, and then disappears. Somebody can help me?
Thank you
|