You are on page 1of 7

;ERRORLEVEL -302

ORG 0000
COUNT1 EQU 0X50
COUNTERREG EQU 0X10
COUNTERVALUE EQU 0X05
TRISA EQU 0XF921
TRISB EQU 0XF93
TRISC EQU 0XF94
TRISD EQU 0XF95
TRISE EQU 0XF96
PORTA EQU 0XF80
PORTB EQU 0XF81
PORTC EQU 0XF82
PORTD EQU 0XF83
PORTE EQU 0XF84
FSR0L EQU 0XFD9
FSR0H EQU 0XFDA
INDF0 EQU 0XFEF
REG1 EQU 0X25
REG2 EQU 0X40
INDF1 EQU 0XFE7
FSR1H EQU 0XFE2
FSR1L EQU 0XFE1
COMMANDWRT
MOVWF PORTD
BCF PORTE,1
BSF PORTE,0
CALL SDELAY
BCF PORTE,0
RETURN
DATAWRT
MOVWF PORTD
BSF PORTE,1
BSF PORTE,0
CALL SDELAY
BCF PORTE,0
MOVLW 0X06
CALL COMMANDWRT
RETURN
;delay routines
LDELAY
MOVLW 0XFF
MOVWF COUNT1
BACK DECF COUNT1, F
BNZ BACK
CALL SDELAY
RETURN
SDELAY
BACK1 MOVLW 0XFF
MOVWF COUNT1
DECF COUNT1, F
BNZ BACK1
RETURN
CLRF TRISA ; MAKE PORT A AS OUTPUT
CLRF TRISB ;MAKE PORT B AS OUTPUT
CLRF TRISC ;MAKE PORT C AS OUTPUT
CLRF TRISD ;MAKE PORT D AS OUTPUT
MOVLW 0X12
MOVWF 0X30
MOVLW 0X13
MOVWF 0X31
MOVLW 0X14
MOVWF 0X31
MOVLW 0X15
MOVWF 0X32
MOVLW 0X16
MOVWF 0X33
L4 MOVLW 0XFF ;INITIALIZE REG1 AND REG2 TO 0XFF
MOVWF REG1
MOVWF REG2
MOVLW 0X00;MAKE WREG AS 0X00
MOVWF PORTB;PUT OXOO ON PORT B
LFSR 0, 0X30; LOAD FSR0 TO 0X30
L2 MOVLW COUNTERVALUE ;LOAD WREG TO 0X05
MOVWF COUNTERREG ;LOAD COUNTER REG
L1 MOVF INDF0, W ;PUT VALUE AT 0X30 INTO WREG
NOP;DELAY
NOP;DELAY
BCF TRISA, 1;MAKE CS TO 0
BSF TRISA, 2;MAKE OE TO 1
BCF TRISA, 3;MAKE WR TO 0
NOP;DELAY
NOP;DELAY
MOVWF PORTD;PUT DATA ON PORT D (DATAT PORT)
INCF FSR0L, F;INCREMENT FSR0
BSF TRISA, 1;MAKE CS TO 1
INCF PORTB, F;INCREMENT THE ADDRESS
DECF COUNTERREG,F;DECREMENT COUNTERREG
BNZ L3;JUMP TO L3
DECF REG1,F ;IF ZERO DECCREMENT REG1
GOTO L2;GOTO L2
L3 DECF REG1,F;DECREMENT REG1
BNZ L1;IF NOT ZERO GOTO L1
INCF PORTC,F;INCREMENT PORT C I.E USE THE HIGHER BITS OF ADDRESS AFTER ROLLI
NG UP TO FF
DECF REG2,F;DECREMENT REG2
BNZ L4;IF NOT ZERO JUMP TO L2
BSF TRISA, 3;MAKE WR TO 1
BSF TRISA, 1;MAKE CS TO 1
BSF TRISA, 2;MAKE OE TO 1
AGAIN BTFSS PORTA, 4;WAIT FOR SOMEONE TO PRESS THE BUTTON TO READ
GOTO AGAIN
GOTO READ

READ MOVLW 0X00;MAKE WREG AS 0


MOVWF PORTB;MAKE PORTB TO 0
L6 MOVLW 0XFF;MAKE REG1 AND REG2 TO 0XFF
MOVWF REG1
MOVWF REG2
SETF TRISD;MAKE PROT D AS INPUT
CLRF PORTD;CLEAR THE PORTD
L5 NOP
NOP
BCF TRISA, 1;MAKE CS TO 0 // START TAKING DATA FROM SRAM
BCF TRISA, 3;MAKE OE TO 0
NOP;DELAY
NOP
NOP
LFSR 1,0X50;LOAD FSR1 TO 0X50
MOVF PORTD, INDF1;PUT DATA WHICH IS ON PORTD TO LOCATION 0X50
CLRF TRISD;MAKE PORT D AS OUTPUT
CLRF TRISE;MAKE PORT E AS OUTPUT
BCF PORTE, 0;ENABLE THE LCD
CALL LDELAY;DELAY
MOVLW 0X38;INITIALIZE THE LCD
CALL COMMANDWRT
CALL LDELAY
MOVLW 0X0E;DISPLAY ON ,CURSOR BLINKING
CALL COMMANDWRT
CALL LDELAY
MOVLW 0X01;CLEAR THE DISPLAY SCREEN
CALL COMMANDWRT
CALL LDELAY
MOVLW 0X06;INCREMENT THE CURSOR
CALL COMMANDWRT
CALL LDELAY
MOVLW 'A'
CALL DATAWRT
CALL SDELAY
MOVLW 'D'
CALL DATAWRT
CALL SDELAY
MOVLW 'R'
CALL DATAWRT
CALL SDELAY
MOVLW 0X84
CALL COMMANDWRT
CALL SDELAY
MOVF PORTB,W
MOVWF PORTD
CALL DATAWRT
CALL SDELAY
MOVF PORTC,W
CALL DATAWRT
CALL LDELAY
MOVLW 0XC0
CALL COMMANDWRT
CALL SDELAY
MOVLW 0X06
CALL COMMANDWRT
CALL SDELAY
MOVLW 'D'
CALL DATAWRT
CALL SDELAY
MOVLW 'A'
CALL DATAWRT
CALL SDELAY
MOVLW 'T'
CALL DATAWRT
CALL SDELAY
MOVLW 'A'
CALL DATAWRT
CALL SDELAY
MOVLW 0XC4
CALL COMMANDWRT
CALL SDELAY
MOVF INDF1,W
CALL DATAWRT
CALL LDELAY
INCF PORTB, F
DECF REG1,F
BNZ L5
INCF PORTC, F
DECF REG2, F
BNZ L6
GOTO $
END