pic lcd not working

Status
Not open for further replies.

yousufsaleem

Junior Member level 1
Joined
Mar 7, 2012
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,414
if build the hex file and tryinh to run it on protues but lcd is not responding



#INCLUDE P18F452.INC
R2 EQU 0x2
R3 EQU 0x3
R4 EQU 0x4
R5 EQU 0x5
R6 EQU 0x6
R7 EQU 0x7
LCD_DATA EQU PORTD
LCD_CTRL EQU PORTD

RS EQU RB0
RW EQU RB1
EN EQU RB2
CLRF TRISD
CLRF TRISB
BCF LCD_CTRL,EN
CALL LDELAY
MOVLW 0x38
CALL COMMAND
CALL LDELAY
MOVLW 0x0E
CALL COMMAND
CALL READY
MOVLW 0x01
CALL COMMAND
CALL READY
MOVLW 0x06
CALL COMMAND
CALL READY
MOVLW 0x86
CALL COMMAND
CALL READY
MOVLW A'N'
CALL DATA_DISPLAY
CALL READY
MOVLW A'O'
CALL DATA_DISPLAY
HERE BRA HERE
COMMAND MOVWF LCD_DATA
BCF LCD_CTRL,RS
BCF LCD_CTRL,RW
BSF LCD_CTRL,EN
CALL SDELAY
BCF LCD_CTRL,EN
RETURN
DATA_DISPLAY MOVWF LCD_DATA
BSF LCD_CTRL,RS
BCF LCD_CTRL,RW
BSF LCD_CTRL,EN
CALL SDELAY
BCF LCD_CTRL,EN
RETURN
READY SETF TRISD
BCF LCD_CTRL,RS
BSF LCD_CTRL,RW
BACK BSF LCD_CTRL,EN
CALL SDELAY
BCF LCD_CTRL,EN
BTFSC LCD_DATA,7
BRA BACK
CLRF TRISD
RETURN


LDELAY
MOVLW D'15'
MOVWF R4
BACK2 MOVLW D'50'
MOVWF R3
AGAIN MOVLW D'250'
MOVWF R2
HERE1 NOP
NOP
DECF R2, F
BNZ HERE1
DECF R3, F
BNZ AGAIN
DECF R4, F
BNZ BACK2
RETURN
SDELAY
MOVLW D'2'
MOVWF R5
BACK1 MOVLW D'10'
MOVWF R6
AGAIN1 MOVLW D'25'
MOVWF R7
HERE2 NOP
NOP
DECF R7, F
BNZ HERE2
DECF R6, F
BNZ AGAIN1
DECF R5, F
BNZ BACK1
RETURN
END
 

VDD terminal of lcd needs 5v string.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…