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.

LCD query.

Status
Not open for further replies.

HerbertMunch

New Member
Im trying to make Nigels tut 1 work.
For some reason, It doesnt work unless i connect my scopes ground to the 5v transformer plugs negative connection!

If i connect the ground lead to the - wire, and then reconnect power to circuit,sure enough I get hello, etc..
If i disconnect the ground lead when its working, the screen stops drawing text, and all the text on screen dissapears.
Now If i reconnect the ground lead before resetting the pic, the screen corrupts.


Whats going on? Anyone have an ideas?


Many thanks.
 
HerbertMunch said:
Im trying to make Nigels tut 1 work.
For some reason, It doesnt work unless i connect my scopes ground to the 5v transformer plugs negative connection!

If i connect the ground lead to the - wire, and then reconnect power to circuit,sure enough I get hello, etc..
If i disconnect the ground lead when its working, the screen stops drawing text, and all the text on screen dissapears.
Now If i reconnect the ground lead before resetting the pic, the screen corrupts.


Whats going on? Anyone have an ideas?


Many thanks.

hi,
My first action would be to check that the 0V/common lines are all interconnected.
Connecting your scope to ground completes a missing ground line, its now grounding via the scope.

EDIT: the 1st paragraph of the tutorial explains the requirement for the resistor, its a requirement of the RA4 [adc] pin.
Look at the datasheet diagram for PORT A.

Hope this helps.
 
Last edited:
Hi eric,
cheers mate.

It seems that the problem is my AC DC adapter!
If i use a 9v battery and reg, no problem.
 
Im now having problems with nigels LCD code 3.

The display does not initialise! Blocks are present on the top line.
Ive narrowed it down to this:


Code:
                LCD_Busy
                bsf	STATUS,	RP0		;set bank 1
		movlw	0x0f			;set Port for input
		movwf	LCD_TRIS
		bcf	STATUS,	RP0		;set bank 0
		bcf	LCD_PORT, LCD_RS	;set LCD for command mode
		bsf	LCD_PORT, LCD_RW	;setup to read busy flag
		bsf	LCD_PORT, LCD_E
		swapf	LCD_PORT, w		;read upper nibble (busy flag)
		bcf	LCD_PORT, LCD_E		
		movwf	templcd2 
		bsf	LCD_PORT, LCD_E		;dummy read of lower nibble
		bcf	LCD_PORT, LCD_E
		btfsc	templcd2, 7		;check busy flag, high = busy
		goto	LCD_Busy		;if busy check again
		bcf	LCD_PORT, LCD_RW
		bsf	STATUS,	RP0		;set bank 1
		movlw	0x00			;set Port for output
		movwf	LCD_TRIS
		bcf	STATUS,	RP0		;set bank 0
		return
 
That code reads the busy flag so as to give the fastest possible response time - presumably you have the R/W line connected up?, and it's not shorting out anywhere?.
 
Excuse me but initialisation and busy flag are things that don't go well together :eek:

Please read the "Reset Function" chapter on page 23 and the "Initializing by instruction" chapter on page 45 of the attached datasheet.

If power up requirements are met in Nigel's circuit he don't need the "Initializing by instruction" stuff and all go well.
If, on the other hand, those requirements aren't met in your circuit you could end-up with a bad initialisation using the same software :(
 

Attachments

  • HD44780.pdf
    322.1 KB · Views: 134
Power Supply Conditions Using Internal Reset Circuit
Item Symbol Min Typ Max Unit Test Condition
Power supply rise time t r CC 0.1 — 10 ms Figure 28
Power supply off time

How do i meet these requirments?
Im using a 9v battery and regulator.
 
mcs51mc said:
Excuse me but initialisation and busy flag are things that don't go well together :eek:

Please read the "Reset Function" chapter on page 23 and the "Initializing by instruction" chapter on page 45 of the attached datasheet.

If power up requirements are met in Nigel's circuit he don't need the "Initializing by instruction" stuff and all go well.
If, on the other hand, those requirements aren't met in your circuit you could end-up with a bad initialisation using the same software :(

hi,
Using this type of LCD on many projects I have never have been able to guarantee the power up requirements needed to meet the power up reset.

If you take the PIC/LED in isolation on a bench test its OK, but as soon as you start to add other devices to the supply power rail this can cause problems with LCD power reset.

For the few lines of initialise delay code and the time and the short time it takes to execute the delays, I would always recommend a software reset, followed by the initialise cycle.

As you say the BUSY flag D7 cannot be tested before/during the first 3 initialise commands.
You must also observe the delay required after power up BEFORE you start initialising the LCD.

If you require the LCD to operate at its maximum rate its best to test the BUSY signal, rather than use long delays when calling the LCD.

Its important that if you use code written for say a 4MHz clock on a 20MHz project that you adjust the LCD delays.
This can be done by using conditional assembly statements in you coding.


Herbert,
Exactly which Tutorial of Nigels are you using?
 
Last edited:
2 Eric
You're a 100% correct about the fact that a few lines of code are better than trying to meet power up requirements.
That's also what I always do :)
I just wanted to catch Herbert's attention on that point so he will know that initialising the LCD has a reason and isn't something everyone does but no one knows why it's done :eek:

2 Herbert
There's a lot on code on that tuturial 3.1, 3.2 and 3.3.
Which one is it?
If you grabbed some code here and there, be sure to use the "LCD_Init" routine from tutorial 3.2 because "LCD_Init" from tutorial:
3.1 doesn't have a wait at the start
3.3 start with "call LCD_Busy ;wait for LCD to settle" and that's very very weird!!

2 Nigel
Some help on this one please
Why 3 different "LCD_Init" routines???
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top