16F628 + LCD JHD162A display problem

Status
Not open for further replies.

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
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'
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
 
Hi,
I don't know this particular LCD, but have used many similar units. Until you know the LCD voltage you need to connect the Vee (contrast) pin to the wiper of a 10K potentiometer with the ends of the pot to Vss and Vdd.
Adjust the pot until you see text or at least a slight "shadow" square at each character location.
Once you have the correct setting you can use a fixed resistor to set the voltage.
This may not be your problem, the LCD could be faulty, wiring wrong or a fault in the code, but if the Vee is wrong you will not see anything.

Robert.
 
Thanks Robert. .. that was it .. when i connected the Vee to gnd , it has shown what i want
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…