|
Components and Circuits For discussions about component types, alternatives and availability, circuit configurations and modifications etc. Discussions here should be of a general nature and not about specific sets. |
|
Thread Tools |
12th Jan 2020, 5:17 pm | #1 |
Nonode
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,612
|
16x2 LCD display not working
Hi,
I built a version of the ELEKTOR lead-acid battery activator that uses a PIC16F1847 to do the work and a 16x2 LCD display to communicate results to the user. Although the circuit appears to work, there are four LEDs that convey some system activity, the LCD is blank. The power is correct, the contrast control changes the display to show blocks at one end of the control range, the backlight is lit. Using the 'scope, I can see signals on the data lines D4 - D7. The lines D0 to D3 are connected to ground. Another small test rig that I have that uses the same display and the display works in that. I'm wondering which bit of magic it is that I don't know. Can anyone help?
__________________
Richard Index: recursive loop: see recursive loop |
12th Jan 2020, 5:49 pm | #2 |
Pentode
Join Date: Jan 2015
Location: Greenock, Inverclyde, UK.
Posts: 161
|
Re: 16x2 LCD display not working
Is the I2C address for the LCD set correctly? Edit: ignore - looked at circuit, its not using I2C to commmunicate to LCD.
Last edited by ian_rodger; 12th Jan 2020 at 5:55 pm. |
12th Jan 2020, 5:49 pm | #3 |
Pentode
Join Date: Dec 2019
Location: Cambridge, UK
Posts: 120
|
Re: 16x2 LCD display not working
What signal are you getting on your select line?
These Hiatchi type displays I believe have a hi/lo for either sending a command or data, long time since I've worked with a 16x02 mind. Cheers, RR |
12th Jan 2020, 6:13 pm | #4 |
Triode
Join Date: Sep 2006
Location: Broughton Preston Lancashire, UK.
Posts: 42
|
Re: 16x2 LCD display not working
Try resetting the processor once powered to see if display initialises. If it does then you need a longer reset on the pic. I had this problem many years ago using a 1st generation 16x2 display it would not initialise properly every time, so I increased the reset cap value and then it worked reliably.
Dave |
12th Jan 2020, 6:56 pm | #5 |
Hexode
Join Date: Oct 2014
Location: Wiltshire, UK.
Posts: 382
|
Re: 16x2 LCD display not working
I remember playing with the 1602 displays some years ago with AVR micros. There is some trickery in persuading them to work in 4 bit data mode since they initially start up in 8 bit mode. I am not sure of the details but it is to do with repeating the same init command a few times and then the 1602 decides that you really, really did want 4 bit mode. When I started playing with them there were some different recommendations as to getting them started in 4 bit mode and not all methods were reliable. I can probably dig out the last version of the init code that I used but it could mean reprogramming the PIC.
Certainly I would say try valves4amps suggestion. Regards, Roger |
12th Jan 2020, 8:40 pm | #6 |
Dekatron
Join Date: May 2008
Location: Derby, UK.
Posts: 7,735
|
Re: 16x2 LCD display not working
The instruction to select 4-bit mode is chosen so that bits 0-3 are "don't care"; but it has to be the first instruction you send to the display module, and you must only strobe it once (so in effect it never gets the bottom nybble). If you assert the strobe a second time, the value you send will be interpreted as the first nybble of a new instruction, and the next thing you send will be interpreted as the second nybble of that instruction.
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments. |
12th Jan 2020, 10:44 pm | #7 |
Hexode
Join Date: Mar 2009
Location: Worthing, Sussex, UK.
Posts: 277
|
Re: 16x2 LCD display not working
I agree with Valveamps. These can take quite a while to initialise - longer than you average PIC or AVR device.
Ging |
13th Jan 2020, 12:25 am | #8 |
Nonode
Join Date: Oct 2010
Location: Tintinara, South Australia, Australia
Posts: 2,340
|
Re: 16x2 LCD display not working
Assuming everything is wired correctly and knowing the display works in another project, the two main causes of "blocks in the display" are:
1/ faulty code. 2/ incorrect oscillator speed setting on the PIC. |
13th Jan 2020, 12:41 am | #9 |
Dekatron
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,575
|
Re: 16x2 LCD display not working
mole42 hasn't mentioned whether the display is being used in read / write mode or in write-only mode.
Read/Write mode is the preferred mode if you can spare one extra uP pin to control the R/W pin on the display because the controlling uP can then poll the 'busy' bit in the status register to ascertain that the display is 'not busy' before sending the next value to the display. Obviously this allows the fastest possible communication with the display because the display tells you as soon as it is ready to receive more data. Write-only mode uses the R/W pin of the display tied to 0V, thus holding it in write mode only. When used this way, the controlling uP has to insert a significant delay between each write to the display to give the display time to process each value sent to it. With this connection method sending the data too fast, with not enough of a delay between writes, would be one possible cause for this problem. When you turn the contrast up and blocks appear, are the blocks on the upper line only? Blocks on one line only = initialisation of the display has not taken place. Blocks on both lines = initialisation of the display may have taken place, as it has been placed into two-line mode. (The default mode of the controller chip is one-line even when built into a two-line display). |
13th Jan 2020, 7:45 am | #10 |
Nonode
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,612
|
Re: 16x2 LCD display not working
Ah! The greyness fades a little.
Turning the contrast reveals only the upper line of blocks so we're not initialising the display. The R/W pin is taken to ground so it's operating in write-only. The device appears to function, it is designed to pulse a MosFET once every 30 seconds, flashing an LED as it does so. That works and I can see the MosFET drive signal on the 'scope. The problem I see is that the PIC is used in a very autonomous fashion, there's no external timing or reset functions (it's possible to use the PIC16F1847 in this manner). As I only have the HEX file to program the chip, I'll have to dis-assemble it to try and find out how to make the display reliably initialise. Thanks guys!
__________________
Richard Index: recursive loop: see recursive loop |
13th Jan 2020, 10:37 am | #11 |
Nonode
Join Date: Oct 2010
Location: Tintinara, South Australia, Australia
Posts: 2,340
|
Re: 16x2 LCD display not working
The "source code" is available on the Elektor site, but unless you have Flowcode 6, it won't be any use.
And disassembly of the hex file wont necessarily give you the config word parameters (went through this over the weekend with something else). |