PDA

View Full Version : lcd interfacing with pic18f452



einton
- 7th July 2009, 15:04
Hi to every one
guys i m interfacing lcd to the pic18f452 and im sending u the following code , i have tested it on hardware circuit i m using 10 mhz crystal and it is not working also i have try to simulate it on proteas and it is not simulating at all i dont know what is the problem and i m perfectly burnt since i m working on it last few days so kindly help me
im posting it

LIST p=18F452 , F=INHX32, MM=OFF, N=0, ST=OFF , R=HEX
#Include <P18F452.INC>
CONFIG OSC=HS , OSCS=OFF
CONFIG WDT=OFF
CONFIG BORV=45, PWRT=ON, BOR=ON
CONFIG DEBUG=OFF, LVP=OFF, STVR=OFF
ORG 00h
LCD_DATA EQU PORTB
LCD_CTRL EQU PORTD
R2 EQU 0*2
R3 EQU 0*3
RS EQU RD0
RW EQU RD1
EN EQU RD2
CLRF TRISD
CLRF TRISB
BCF LCD_CTRL,EN
CALL LDELAY
MOVLW 0*38
CALL COMNWRT
CALL LDELAY
MOVLW 0*0E
CALL COMNWRT
CALL LDELAY
MOVLW 0*01
CALL COMNWRT
CALL LDELAY
MOVLW 0*06
CALL COMNWRT
CALL LDELAY
MOVLW 0*84
CALL COMNWRT
CALL LDELAY
MOVLW A'P'
CALL DATAWRT
CALL LDELAY
MOVLW A'A'
CALL DATAWRT
CALL LDELAY
MOVLW A'K'
CALL DATAWRT
AGAOP BTG LCD_CTRL,0
BRA AGAOP
COMNWRT
MOVWF LCD_DATA
BCF LCD_CTRL,RS
BCF LCD_CTRL,RW
BSF LCD_CTRL,EN
CALL LDELAY
BCF LCD_CTRL,EN
RETURN
DATAWRT
MOVWF LCD_DATA
BSF LCD_CTRL,RS
BCF LCD_CTRL,RW
BSF LCD_CTRL,EN
CALL LDELAY
BCF LCD_CTRL,EN
RETURN
ORG 500H
LDELAY
MOVLW D'40'
MOVWF R2
AJAIN MOVLW D'250'
MOVWF R3
HERE NOP
NOP
DECF R3,F
BNZ HERE
DECF R2,F
BNZ AJAIN
RETURN
END

BobK
- 7th July 2009, 22:41
Hello Einton,

Perhaps you didn't notice that this forum is specific to Pic Basic compilers. The are just a few people here that understand assembly language. We
also don't do Proteas here. Pic Basic compilers don't work with simulators.
I believe Onshon has a form of Pic Basic that has a simulator but it is a variable that doesn't work with the compilers we use here.

You might try www.microchip.com. They have forums that help with assembly and C languages.

Sorry we can't be of more help.

BobK