Searching \ for '[PIC] LCD sanity' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/io/lcd/pic.htm?key=lcd
Search entire site for: 'LCD sanity'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] LCD sanity'
2006\04\03@011829 by kravnus wolf

picon face
I have written code for the LCD from bgmicro

http://www.bgmicro.com/prodinfo.asp?sid=0968912037037037604814310&prodid=LCD1022&page=1&cri=lcd&stype=3

I managed to get it started and printing characters on
it. What grips me is that if I reset the PIC through
MCLR quickly and numerous times the LCD just prints
blank! It seems that the LCD cannot handle quick
restart over and over again. I am left
clueless........

Thanks,
John

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

2006\04\03@014106 by Phillip

picon face


Hi John

I was using an LCD from Hantronix last year that would get into a latch up
state when I reset my pic.


I put pull ups (and maybe pull downs, I'm not at work and my one remaining
brain cell is holding my name) on the RS, enable and W/R lines and I was
able to keep it straight most of the time.
I canned the thing half way through development and went to a Crystalfontz
because it was not RoHS compliant.

The Crystalfontz will crap out if I write to it when/if it is busy.
When I turn the port around on my PIC 18F6520 from R to W or vise versa if I
don't put a 50usec delay before I read or write the data does not either go
to the thing (out the port) or come from the thing (in the port) and I blow
on by to the next read or write life turns to carp.
I don't think it is capacitance on the lines (like the long cable guy
earlier) they are very short.
Mostly I do RF stuff here so I have a good idea about capacitance of my
boards.
I swear there is some kind of turn around where you can read/write the port
fast after it is turned around but you have to wait till it is ready to go.
I'm going to do some more testing AM.
I'll figure it out eventually.
Phillip
Things should be as simple as possible but no simpler



Phillip Coiner
CTO, GPS Source, Inc.


Your source for quality GNSS Networking Solutions and Design Services, Now!

{Original Message removed}

2006\04\03@045824 by kravnus wolf

picon face
It looks like there are others out there. sigh...... I
need to buy here and there until I get a right
one........ QC really kills enthusiasm.

I managed to get weird characters printed randomly
during quick reset but solved it by discharging the
LCD of mine each time before init it..... Please do
inform the PICLIST on how you solve your problem.

Thanks,
John




--- Phillip <spam_OUTpcoinerTakeThisOuTspamgpssource.com> wrote:

{Quote hidden}

> {Original Message removed}

2006\04\03@130602 by M. Adam Davis

face picon face
What is your LCD init routine?  I've never experienced that problem
with the cheap LCDs I have used with this routine:

write4 just writes 4 bits to the LCD interface, write8 writes 8 bits
in two cycles of 4 bits.  The rest should be pretty explanatory,
except for the ??? which I sure could be determined from the data
sheet in short order.

void initlcd(void)
{
       delayms(20);        // Wait for LCD to power up ( >15ms )
       RS=0;                // Set RS low for instruction
       write4(3);        // Set interface to 8 bits
       delayms(5);        // Wait for LCD execute instruction ( >4.1ms )
       write4(3);        // Set interface to 8 bits
       delayms(1);        // Wait for LCD execute instruction ( >100us )
       write4(3);        // Set interface to 8 bits
       delayms(5);          // Wait for LCD execute instruction (At this point
                       // we could actually start using the busy flag)
       write4(2);        // Set the display to 4 bit interface
       delayms(5);        // Wait for LCD execute instruction
       write8(0x28);        // Set the display to two line and ???
       delayms(5);        // Wait for LCD execute instruction
       write8(6);        // ???
       delayms(5);        // Wait for LCD execute instruction
       write8(1);        // Clear the LCD
       delayms(5);        // Wait for LCD execute instruction
       write8(0xf);        // ???
       delayms(5);        // Wait for LCD execute instruction
       return;
}

-Adam

On 4/3/06, kravnus wolf <.....kravnusKILLspamspam@spam@yahoo.com> wrote:
{Quote hidden}

> -

2006\04\03@135154 by Tarun Grover

picon face
I've recently completed a project involving an LCD using this same
controller.  What I found is that with the 2 LCD's I was using for testing,
this initialization routine did not work.  What I found DID work was when I
left out
the first 3 'write4(3)' instructions.  Now, this goes against
everything I've read on the internet and from Hitachi's Datasheet.  I
only found 1 instance where someone used a different initialization
scheme and this seemed to work for me.

Was there anything wrong with what I was doing or do different LCD's behave
differently (even though they use the same controller)?

Here is my initialization routine:

void lcd_init(void)
{
LCD_EN_DIR = 0;                     //Set EN and RS lines to output;
LCD_RS_DIR = 0;

TRISBbits.TRISB0 = 0;             //Set data lines to output;
TRISBbits.TRISB1 = 0;
TRISBbits.TRISB2 = 0;
TRISBbits.TRISB3 = 0;

LCD_EN = 0;
LCD_RS = 0;                          //Write control bytes.
delay(1300000);

PORTB = 0x0002;                   //Set 4 bit mode.
LCD_STROBE();

lcd_write(0x28);                     //4 bit mode, 1/16 duty, 5x8 font.
lcd_write(0x08);                     //Display off.
lcd_write(0x0C);                    //Display on, cursor on.
lcd_write(0x06);                    //Entry mode.
}

Any insights?

-Tarun.

On 4/3/06, M. Adam Davis <stienmanspamKILLspamgmail.com> wrote:
{Quote hidden}

2006\04\03@162632 by M. Adam Davis

face picon face
I only see one delay.  If you carefully read the data sheet there are
notes to the effect of how much time each command takes to execute,
and how long a power up delay should be.

I suspect that you could add all the suggested commands back in if you
carefully followed the delay notes.

-Adam

On 4/3/06, Tarun Grover <EraseMEtarun.groverspam_OUTspamTakeThisOuTgmail.com> wrote:
{Quote hidden}

>

2006\04\03@165309 by Tarun Grover

picon face
The code I posted is the version that works.  My original code was similar
to the one posted earlier in the thread and had more than enough
delays (to the best of my knowledge) but still did not work.  I'm just
wondering if anyone has experienced something similar as I tried for a few
days to diagnose this problem and could not come up with a solution until I
mistakingly left out the write(3) part of the code.  That code above is my
final working copy and works perfectly with the 2 LCDs I have.  The delay
you see on there is the power-up delay.

-Tarun.

On 4/3/06, M. Adam Davis <KILLspamstienmanKILLspamspamgmail.com> wrote:
{Quote hidden}

> >

2006\04\03@174701 by Stef Mientki

flavicon
face


Tarun Grover wrote:
> I've recently completed a project involving an LCD using this same
> controller.  What I found is that with the 2 LCD's I was using for testing,
> this initialization routine did not work.  What I found DID work was when I
> left out
> the first 3 'write4(3)' instructions.  Now, this goes against
> everything I've read on the internet and from Hitachi's Datasheet.  I
> only found 1 instance where someone used a different initialization
> scheme and this seemed to work for me.
>
> Was there anything wrong with what I was doing or do different LCD's behave
> differently (even though they use the same controller)?
>
>  
I had trouble with some VARITRONIX LCDs,
So here is what works till now for about 10 different LCD's

--    - Extra delay in Init procedure, after 4-bits setting,
--      needed for VARITRONIX MDLS-16268-series
 delay_1mS ( 40 )                      -- even long enough for Vcc as
low as 2.7V
 HD44780_DataCmd_pin = low                 -- select command
 _HD44780_write_low_nibble ( 0b_0011 ) -- first init
 delay_1mS ( 5 )                       -- extra delay
 _HD44780_write_low_nibble ( 0b_0011 ) -- second init
 delay_10uS( 10 )                      -- extra delay
 _HD44780_write_low_nibble ( 0b_0011 ) -- third init

 _HD44780_write_low_nibble ( 0b_0010 ) -- set 4-bit interface
 delay_10uS( _HD44780_short_delay )    -- FOR SOME DISPLAYS
(VARITRONIX) required delay
 _HD44780_Command( 0b_0010_1000 )      -- two lines, 5x7 (high nibble)
 _HD44780_Command( 0b_0000_1111 )      -- display on, cursor on, blink on
 _HD44780_Command( 0b_0000_0001 )      -- clear display
 _HD44780_Command( 0b_0000_0110 )      -- increment and no shift

Stef Mientki

2006\04\03@214237 by kravnus wolf

picon face
I have tried the pseucode in the datasheet. I go home
and try yours again. Somehow my LCD operation is much
more consistent when I prolong the delay...... Yet the
reset part is still problematic at times.

Thanks,
john

--- "M. Adam Davis" <RemoveMEstienmanspamTakeThisOuTgmail.com> wrote:

{Quote hidden}

www.bgmicro.com/prodinfo.asp?sid=0968912037037037604814310&prodid=LCD1022&page=1&cri=lcd&stype=3
{Quote hidden}

2006\04\03@215059 by kravnus wolf

picon face
By right it should not stray that far.... Is your chip
really a Hitachi HD44870 chip or a compatible one?

John

--- Tarun Grover <EraseMEtarun.groverspamgmail.com> wrote:

{Quote hidden}

www.bgmicro.com/prodinfo.asp?sid=0968912037037037604814310&prodid=LCD1022&page=1&cri=lcd&stype=3
{Quote hidden}

>

2006\04\04@005251 by Tarun Grover

picon face
I had trouble with some VARITRONIX LCDs,
So here is what works till now for about 10 different LCD's

--    - Extra delay in Init procedure, after 4-bits setting,
--      needed for VARITRONIX MDLS-16268-series
 delay_1mS ( 40 )                      -- even long enough for Vcc as
low as 2.7V
 HD44780_DataCmd_pin = low                 -- select command
 _HD44780_write_low_nibble ( 0b_0011 ) -- first init
 delay_1mS ( 5 )                       -- extra delay
 _HD44780_write_low_nibble ( 0b_0011 ) -- second init
 delay_10uS( 10 )                      -- extra delay
 _HD44780_write_low_nibble ( 0b_0011 ) -- third init

 _HD44780_write_low_nibble ( 0b_0010 ) -- set 4-bit interface
 delay_10uS( _HD44780_short_delay )    -- FOR SOME DISPLAYS
(VARITRONIX) required delay
 _HD44780_Command( 0b_0010_1000 )      -- two lines, 5x7 (high nibble)
 _HD44780_Command( 0b_0000_1111 )      -- display on, cursor on, blink on
 _HD44780_Command( 0b_0000_0001 )      -- clear display
 _HD44780_Command( 0b_0000_0110 )      -- increment and no shift

Stef Mientki
This is what I see posted all over the web and it didn't seem to work.
I saw only 1 mention of the way I implemented
my initialization and that's what did the trick.  It almost seems as if
though the LCD is starting in 4-bit mode by default, but that makes no
sense.

Anyhow, I am not trying to hijack this thead so I guess I'll have to work
with it again once I have some spare time after final exams :(

-

2006\04\04@013619 by kravnus wolf

picon face


--- Tarun Grover <RemoveMEtarun.groverTakeThisOuTspamspamgmail.com> wrote:

{Quote hidden}

 They have to start at 4 bits to support the smallest
denominator which is 4 bit interface. Once the set
function for 8 bit than it would use the next 4 pins
for the 8 bit interface.

john
>
> Anyhow, I am not trying to hijack this thead so I
> guess I'll have to work
> with it again once I have some spare time after
> final exams :(
>
> --

2006\04\04@054244 by Alan B. Pearce

face picon face
>It almost seems as if though the LCD is starting in
>4-bit mode by default, but that makes no sense.

You are correct that it starts in 4 bit mode. That is why the mode set
command is formatted the way it is, and also why you have to send it twice,
wether you are doing 4 bit or 8 bit mode.

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...