;============================================================
; File name:
; Date:
; Author:
; Processor:
; Reference circuit:
;============================================================
; Copyright notice:
;============================================================
; Program Description:
;
;===========================
; configuration switches
;===========================
list p=16f877A ; list directive to define processor
#include <p16f877A.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF
;=====================================================
; constant definitions
;=====================================================
;=====================================================
; PIC register equates
pcl EQU 2
;=====================================================
;=====================================================
; variables in PIC RAM
;=====================================================
cblock 0x20
counter1 : 1
counter2 : 1
number : 1
endc
;============================================================
; program
;============================================================
org 0X00 ; start at address
goto main
; Space for interrupt handlers
org 0x08
delay
movlw 0x30
movwf counter2
loop1
movlw 0xff
movwf counter1
loop2
nop
decfsz counter1
goto loop2
decfsz counter2
goto loop1
return
instw
movwf PORTB
call delay
bcf PORTD,4
call delay
bsf PORTD,5
call delay
bcf PORTD,5
call delay
return
dataw
movwf PORTB
call delay
bsf PORTD, 4
call delay
bsf PORTD, 5
call delay
bcf PORTD, 5 ;Transitional E signal
call delay
return
main:
bsf STATUS,RP0
movlw 0x00
movwf TRISB
movwf TRISD
bcf STATUS,RP0
clrf PORTD
clrf PORTB
call delay
call delay
start
clrf PORTD ;Here RW is pulled down to ground
;LCD routine starts
call delay
;give LCD module to reset automatically
;Fundtion for 8-bit, 2-line display, and 5x8 dot matrix
movlw 0x38
call instw
call delay
movlw 0x0F
call instw
call delay
movlw 0x01
call instw
call delay
movlw 0x48
call dataw
movlw 0x45
call dataw
movlw 0x4c
call dataw
movlw 0x4c
call dataw
movlw 0x4f
call dataw
movlw 0x20
call dataw
movlw 0x57
call dataw
movlw 0x4f
call dataw
movlw 0x52
call dataw
movlw 0x4c
call dataw
movlw 0x44
call dataw
kais
goto kais
;============================================================
end ; END OF PROGRAM
;============================================================