akg
New Member
Hello all
i was just trying to i/f the lcd module with a 16f628a , code below, most of them from nigel's site
the init routine was based on an Hd44780 pdf file . i have not connected the backlight pins. the contrast pin is directly connected to vcc . the problem is the lcd is not showing 'any' sign of life. :? can i assume the lcd to be dead or is there something wrong in the code/init sequence ?. any help would be appreciated.
thanks
i was just trying to i/f the lcd module with a 16f628a , code below, most of them from nigel's site
Code:
list p=16f628A
#include <p16F628A.inc>
; errorlevel -302
__CONFIG _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT
cblock 0x20
count1
counta
countb
endc
LCD_CTRL equ PORTA
LCD_PORT equ PORTB
LCD_RS equ 0x0
LCD_RW equ 0x1
LCD_E equ 0x2
;**********************************************************************
ORG 0x000
clrf INTCON
call Delay255
call Delay255
call Delay255
call Delay255
movlw 0x07
movwf CMCON
clrf PORTA
clrf PORTB
bsf STATUS,RP0
clrf TRISA
clrf TRISB
bcf STATUS,RP0
call LCD_Init
call Delay100
movlw 'A'
call LCD_Char
movlw 'B'
call LCD_Char
movlw 0xC0
call LCD_Cmd
movlw 0x1
call LCD_CharD
lp goto lp
LCD_Init
bcf LCD_CTRL,LCD_RW
bcf LCD_CTRL, LCD_E
call Delay100
movlw 0x38
call LCD_Cmd
movlw 0x38
call LCD_Cmd
movlw 0x38
call LCD_Cmd
movlw 0x38
call LCD_Cmd
movlw 0x08
call LCD_Cmd
movlw 0x01
call LCD_Cmd
movlw 0x06
call LCD_Cmd
movlw 0x02
call LCD_Cmd
movlw 0x0F
call LCD_Cmd
movlw 0x80
call LCD_Cmd
retlw 0x0
LCD_Cmd
movwf LCD_PORT
bcf LCD_CTRL, LCD_RS ;RS line to 0
call Pulse_e ;Pulse the E line high
call Delay50
retlw 0x0
LCD_CharD
addlw 0x30
LCD_Char
movwf LCD_PORT
bsf LCD_CTRL,LCD_RS
call Pulse_e
call Delay50
retlw 0x0
Pulse_e
bsf LCD_CTRL, LCD_E
nop
nop
nop
bcf LCD_CTRL, LCD_E
retlw 0x00
Delay255
movlw 0xff ;delay 255 mS
goto d0
Delay100
movlw d'100' ;delay 100mS
goto d0
Delay50
movlw d'50' ;delay 50mS
goto d0
Delay20
movlw d'20' ;delay 20mS
goto d0
Delay5
movlw 0x05 ;delay 5.000 ms (4 MHz clock)
d0 movwf count1
d1 movlw 0xC7 ;delay 1mS
movwf counta
movlw 0x01
movwf countb
Delay_0
decfsz counta, f
goto $+2
decfsz countb, f
goto Delay_0
decfsz count1 ,f
goto d1
retlw 0x00
END ; directive 'end of program'
thanks