Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

in trouble with LCD (JHD162A)

Status
Not open for further replies.
smileguitar said:
Sorry, what do you mean a known working LCD driver programme? I think I never tried it before. Really sorry, this is the first time I touch LCD and not really know about the well known LCD driver programme. erm... How it is try...

Thanks!!
hi,
Its the one I posted a few days ago,, IIRC.... 'lcd2line'

To determine the cause of a problem, sometimes you have to use a known 'good' program or component.
For example: say you had a spare LCD on the shelf, you would try it in the place of the suspect one. If it worked with the new one that would most likely mean the first one is faulty.
If it still didnt work with a new LCD that would mean the problem is most likely something else other than the LCD.

The same applies to a program,, the program i posted works with a HD44870 LCD controller and the same type of PIC that you are using.
If my program drives the LCD OK, this means the fault is most likely your program,,, if the LCD dosnt work with my program then either the LCD is faulty or the LCD wiring is faulty.

Its necessary when fault finding to go thru a process of elimination, using devices or programs of known quality...

Do You follow this???

Its this one.
 
Last edited:
ericgibbs said:
hi,
Its the one I posted a few days ago,, IIRC.... 'lcd2line'

To determine the cause of a problem, sometimes you have to use a known 'good' program or component.
For example: say you had a spare LCD on the shelf, you would try it in the place of the suspect one. If it worked with the new one that would most likely mean the first one is faulty.
If it still didnt work with a new LCD that would mean the problem is most likely something else other than the LCD.

The same applies to a program,, the program i posted works with a HD44870 LCD controller and the same type of PIC that you are using.
If my program drives the LCD OK, this means the fault is most likely your program,,, if the LCD dosnt work with my program then either the LCD is faulty or the LCD wiring is faulty.

Its necessary when fault finding to go thru a process of elimination, using devices or programs of known quality...

Do You follow this???

Its this one.

I did test the LCD with the programme that you provided, it not work; means that the possibility for LCD faulty and LCD wiring is faulty. So, I have to use your programme to test in the new LCD. If work in new LCD, I'll know the result, am I right?

Erm... could you help me to double check again my connection of LCD? I've attached it above.

Thanks!!
 

Attachments

  • LCD schematic.jpg
    LCD schematic.jpg
    134.7 KB · Views: 528
You can't just connect VEE to gnd, it generally need to be adjustable and some LCDs require a small negative voltage.
Put a 10K pot bettween pins 1 & 2 with the wiper going to pin 3.
**broken link removed**
 
blueroomelectronics said:
You can't just connect VEE to gnd, it generally need to be adjustable and some LCDs require a small negative voltage.
Put a 10K pot bettween pins 1 & 2 with the wiper going to pin 3.
**broken link removed**

Ok, thanks!
 
Hey smileguitar. I just wired an LCD up to a 16F877A I had kickin around, using pretty much your original post schematic, but with some minor changes.

I programmed the chip with your original posted code (fixed the BANK0 macro error).

It works fine. Prints "YES" on line 1 and "123" on line 2.

I'll draw up a quicky schematic of how I wired it and post tonight. Meanwhile, here's the code with that one tiny error fixed:
Code:
	LIST P=16F877
	#INCLUDE <P16F877.INC>
	__CONFIG 0X3F32

; MACRO
BANK0	MACRO
	BCF	STATUS,RP0
	BCF	STATUS,RP1
	ENDM

BANK1	MACRO
	BSF	STATUS,RP0
	BCF	STATUS,RP1
	ENDM


CLOCK_E	MACRO
	BSF	PORTD,3
	CALL	DELAY2
	BCF	PORTD,3
	ENDM

; VARIABLE
D1	EQU	0X20
D2	EQU	0X21
D3	EQU	0X22
D4	EQU	0X23
D5	EQU	0X24
D6	EQU	0X25

; MAIN PROGRAM
	ORG	0X0000
	GOTO	START

STOP	ORG	0X0004
	GOTO	STOP

START	BANK0
	CLRF	PORTA
	CLRF	PORTB
	CLRF	PORTC
	CLRF	PORTD
	CLRF	PORTE

	BANK1
	MOVLW	0x06
	MOVWF	ADCON1
	CLRF	TRISA
	CLRF	TRISB
	CLRF	TRISC
	CLRF	TRISD
	CLRF	TRISE

	BANK0
	CLRF	PORTB

; LCD INITIALIZED
	CALL	DELAY1
	BCF	PORTD,2
	MOVLW	B'00110000'
	MOVWF	PORTB
	CLOCK_E

	CALL	DELAY2
	MOVLW	B'00001101'
	MOVWF	PORTB
	CLOCK_E

	CALL	DELAY3
	MOVLW	B'00111000'
	MOVWF	PORTB
	CLOCK_E
	MOVLW	B'00000001'
	MOVWF	PORTB
	CLOCK_E
	MOVLW	B'00000110'
	MOVWF	PORTB
	CLOCK_E

; MESSAGES DISPLAY IN LINE 1
	BSF	PORTD,2
	MOVLW	H'59'
	MOVWF	PORTB	;DISPLAY "YES"
	CLOCK_E
	MOVLW	H'45'
	MOVWF	PORTB
	CLOCK_E
	MOVLW	H'53'
	MOVWF	PORTB
	CLOCK_E

; SET LCD TO SECOND LINE
	BCF	PORTD,2
	MOVLW	B'11000000'
	MOVWF	PORTB
	CLOCK_E

; MESSAGES DISPLAY IN LINE 2
	BSF	PORTD,2
	MOVLW	H'31'
	MOVWF	PORTB	;DISPLAY123
	CLOCK_E
	MOVLW	H'32'
	MOVWF	PORTB
	CLOCK_E
	MOVLW	H'33'
	MOVWF	PORTB
	CLOCK_E

	GOTO	$-1

; SUBROUTINE FOR DELAY
DELAY1 MOVLW D'65' ;DELAY 50ms
	MOVWF	D2
	MOVLW	D'238'
	MOVWF	D1
LOOP1	DECFSZ	D1,1
	GOTO	LOOP1
	DECFSZ	D2,1
	GOTO	LOOP1
	RETURN

DELAY2	MOVLW	D'13'	;DELAY 10ms
	MOVWF	D4
	MOVLW	D'251'
	MOVWF	D3
LOOP2	DECFSZ	D3,1
	GOTO	LOOP2
	DECFSZ	D4,1
	GOTO	LOOP2
	RETURN

DELAY3	MOVLW	D'1'	;DELAY 100us
	MOVWF	D6
	MOVLW	D'31'
	MOVWF	D5
LOOP3	DECFSZ	D5,1
	GOTO	LOOP3
	DECFSZ	D6,1
	GOTO	LOOP3
	RETURN

	END

Couple pics:
**broken link removed**
**broken link removed**
 
Last edited:
futz said:
I'll draw up a quicky schematic of how I wired it and post tonight.
Bah! Too much work. Here's the LCD connections.

LCD Pins:
Pin 1. Ground (VSS)
Pin 2. 5V (VDD)
Pin 3. 1K resistor to ground (VSS).
Pin 4. RD2 and also a 10K pullup resistor
Pin 5. Ground (VSS)
Pin 6. RD3
Pin 7. RB0
Pin 8. RB1
Pin 9. RB2
Pin 10. RB3
Pin 11. RB4
Pin 12. RB5
Pin 13. RB6
Pin 14. RB7
Pin 15. 5V (VDD) (Backlight)
Pin 16. Ground (VSS) (Backlight)

I determined the resistor value for Pin 3 by first putting a 10K potentiometer in using one leg and the wiper from pin 3 to ground, adjusting it till the display looked good, removing it and measuring the resistance and putting that value of resistor back in place of the pot. LCDs vary from model to model. If you just put in the resistor there's a good chance you'll end up with maladjusted contrast and have a "blank display".

Silly questions:
You ARE using a 4MHz crystal as the schematic shows, right? If you aren't, that would explain the the blinking LED program working but the LCD not working. The LCD delay durations depend on the PIC running at that 4MHz clock speed (or lower, but not higher). If you put (for instance) a 20MHz crystal on the PIC the LCD is not gonna work until you change either the code or the crystal.

Is your MCLR pulled up properly? If not the chip could possibly be doing something weird like restarting over and over, giving the illusion that the blinky program is actually running when it's really not. Try making some changes to the blinky prog and see if it responds correctly.

Got enough juice? Not enough power can cause LCDs to not work properly. I found this one out the hard way a couple times. Backlight seemed to be working, but couldn't get the display to work right. Got better power to it and it took right off. It had been working all along but I couldn't see it.
 
Last edited:
Today I tested the new LCD with my programme, it works. I'm so happy, testing for a long time, today success. Now I know the big problem is caused by the LCD failure. Thanks to all who give suggestion, advise and encouragement. Eric, Eng1, mvs sarma, Pommie, blueroomelectronics and futz, THANK YOU VERY MUCH!! :) :D

Erm... Now I've one more question to ask.... If the LCD feel a bit warm is consider burnt?

Today I tested the new LCD can work properly, but I think through my careless, I connected wrongly that caused the cicuit short. After that the LCD cannot function anymore and feel slightly warm. Is LCD burnt?? (I'm so stupid :( )
 
smileguitar said:
Today I tested the new LCD with my programme, it works. I'm so happy, testing for a long time, today success. Now I know the big problem is caused by the LCD failure. Thanks to all who give suggestion, advise and encouragement. Eric, Eng1, mvs sarma, Pommie, blueroomelectronics and futz, THANK YOU VERY MUCH!! :) :D

Erm... Now I've one more question to ask.... If the LCD feel a bit warm is consider burnt?

Today I tested the new LCD can work properly, but I think through my careless, I connected wrongly that caused the cicuit short. After that the LCD cannot function anymore and feel slightly warm. Is LCD burnt?? (I'm so stupid :( )
Hey Smileguitar,

Are you telling about the old display that went faulty or,god forbid, is it second time failure?

Generally the voltage pattern at pins 1,2 and 16,15, they are symmetrical. even if pin3 goes to pin 14, it could be imagined as high or low input on D7-this also should not matter. So reverse connection may not cause failure of display and when normalcy restored,it should start working. But, on the other hand if connection pulled out while the supply is ON and display working, this type of failure is anticipated , as far as i could analyze.
 
mvs sarma said:
Hey Smileguitar,

Are you telling about the old display that went faulty or,god forbid, is it second time failure?

Generally the voltage pattern at pins 1,2 and 16,15, they are symmetrical. even if pin3 goes to pin 14, it could be imagined as high or low input on D7-this also should not matter. So reverse connection may not cause failure of display and when normalcy restored,it should start working. But, on the other hand if connection pulled out while the supply is ON and display working, this type of failure is anticipated , as far as i could analyze.

I'm telling about the new display. I'm not connect wrongly at LCD pins, but in MCLR pin of PIC. I connect a push button in pin1 of PIC with a diode, resistor and capacitor. Unfortunately, I made it short circuit. After this, my new LCD is not function stable. Is LCD burnt again? or.....???
 
blueroomelectronics said:
LCDs are really easy to kill, if you ever reverse power & gnd it's ususually bye bye.

i was talking about the reversal of the entire 16 pin connector of LCD display with spl ref to JHD162A model. Generally voltage reversal in solidstate circuits and digital circuits,kills many ICs. memories more instantaneously.

however Smileguitar confirms that it is case of mishandling pin1 of the 16F877 (MCLR), i suppose. That might not cause such serious damage to LCD display, i hope, as there is no Vpp at a working board.
 
mvs sarma said:
i was talking about the reversal of the entire 16 pin connector of LCD display with spl ref to JHD162A model. Generally voltage reversal in solidstate circuits and digital circuits,kills many ICs. memories more instantaneously.

however Smileguitar confirms that it is case of mishandling pin1 of the 16F877 (MCLR), i suppose. That might not cause such serious damage to LCD display, i hope, as there is no Vpp at a working board.


Hopefully. Thanks in advance. I'll double check it....
 
datasheet

ericgibbs said:
hi,
Tried running your code on my simulator, it looks as though the LCD controller is the Hitachi HD44780.
All I get on the LCD is '23' on the second line.
Where are the RS and R/W lines connected?

I dont see any reference to these control lines in your program.

Also you have enclosed your web link in 'brackets' I cannot call it!.
EDIT:
Managed to get the gif, see that RS is on RD2 and R/W is low.[/QUOTE

sir i want jhd162a lcd dtasheet,cn u pls suggest wre i cn get tat... i dint get tat anywhere.....
 
Hi eric, could u give the lcd2line.asm file because i couldn't get the attached file. because i'm also having the same problem like smileguitar
 
Hi eric, could u give the lcd2line.asm file because i couldn't get the attached file. because i'm also having the same problem like smileguitar

hi,:)
For some reason the original posted file has gone.!

This is a copy from my PC.

EDIT: which pins of the 628A are connected to the LCD.??
 

Attachments

  • lcd2line1.asm
    2.6 KB · Views: 169
Last edited:
hi,:)
For some reason the original posted file has gone.!

This is a copy from my PC.

EDIT: which pins of the 628A are connected to the LCD.??


The assembly code is quite hard to understand but i will try to explore it...ya, it is nice of you to give me the code.Thank you very much.
 
The assembly code is quite hard to understand but i will try to explore it...ya, it is nice of you to give me the code.Thank you very much.

hi,
If you post which pins you are using, I could change the asm to suit.:)
 
My LCD JHD162A cannot display any characters

I have checked many times of my circuit connection of LCD with my Microcontroller MC68HC11E, even the programming code I have edited many times, but the LCD still can't display any characters. I have to summit my project by next week. Anyone can help me please!!! Pin E I connected to PA3, Pin RS connected to PA4, Pin R/W connected to PA7 and DB0-DB7 connected to PC0-PC7. The following is my programming code:

LCD to MC68HC11.jpg

ORG $B600
PORTA EQU $1000
PORTC EQU $03
DDRC EQU $07

LDX #PORTA
LDAA #$FF
STAA DDRC,X
BCLR PORTC,X,$FF
LDS #$FF

LDY #INITIAL
LOOP LDAA 0,Y
BEQ START
BSR INS
INY
BRA LOOP

START LDY #DATA
LDAA #$80
AGAIN BSR INS
LDAB 0,Y
BSR CHAR
INY
INCA
CMPA #$87
BNE AGAIN
NOP

ENABLE BSET 0,X,$08
BSR DELAY
RTS

INS BCLR 0,X,$90
STAA PORTC,X
BSR ENABLE
RTS

CHAR BSET 0,X,$90
STAB PORTC,X
BSR ENABLE
RTS

DELAY PSHB
PSHX
LDAB #1
LOOP3 LDX #$7FFF
LOOP2 DEX
BNE LOOP2
DECB
BNE LOOP3
PULX
PULB
RTS

INITIAL FCB $01,$02,$06,$0C,$14,$38,0
DATA FCC "WELCOME"
END
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top