

                            Character LCD Checker

                               by Steve Lawther
                               
This code was originally written for those people having a problem with their
circuitry when building my AT keyboard viewer, and is useful for checking an
LCD and wiring is working correctly.

The main problem tends to be that the display contrast is not set correctly,
or that they have used an extended temperature range display without realizing
that it needs a negative contrast voltage.

This code simply initializes the display, then writes characters to it.


Connections:-
=============

    Port A      0 - led with current limiting resistor to +5V
              1-4 - spare - set to inputs, in case circuitry is connected
    Port B      0 -   "   -  "   "   "      "   "      "      "     "
                1 - LCD control line E 
                2 - LCD control line R/W
                3 - LCD control line RS
              4-7 - LCD data 4 - 7
              osc - 10MHz **
              Vcc - +5v
            /mclr - +5v
              Vss - gnd

    ** - a 4MHZ crystal can be used - flashes will be 1.25 second long
         every 10 seconds
                              
For a GIF diagram of the circuit, see LCDTEST.GIF in this ZIP              
              
Indications:-
=============

indication on LED, repeated every 4 seconds :-

  constantly on or off - PIC not running, or not programmed correctly, or
                         LED not wired up correctly
  
   1 x 1/2 sec flash   - all GOOD - LCD working correctly
                         (if display not readable, alter contrast)
  
   2 x 1/2 sec flashes - Pins shorted / wired wrong
                         (After setting the signals to the LCD, they read
                          back differently)
   3 x 1/2 sec flashes - LCD busy too long or no display attached
                         (After waiting long enough for an LCD instruction
                          to have finished, the busy flag still reads as busy)
   4 x 1/2 sec flashes - address readback incorrect - check data wiring
                         (After setting LCD to auto increment character
                          address, read back character address is different
                          to that expected)

When correctly connected, and contrast set correctly, part of the character
set will be displayed on the LCD:-

For a 1x8 display:-  _!"#$%&'

For a 1x16 display
        EITHER   :-  _!"#$%&'`abcdefg  For LCD logically configured as 2x8
          OR     :-  _!"#$%&'()*+,-./  For LCD logically configured as 1x16

For a 1x20 display:- _!"#$%&'()*+,-./0123

For a 2x16 display:- _!"#$%&'()*+,-./
                     `abcdefghijklmno

For a 2x20 display:- _!"#$%&'()*+,-./0123
                     `abcdefghijklmnopqrs

For a 2x24 display:- _!"#$%&'()*+,-./01234567
                     `abcdefghijklmnopqrstuvw

For a 2x32 display:- _!"#$%&'()*+,-./0123456789:;<=>?
                     `abcdefghijklmnopqrstuvwxyz{|}><  (last 2 characters are )
                                                       ( arrows               )

For a 2x40 display:- _!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG
                     `abcdefghijklmnopqrstuvwxyz{|}><???????? (last 8 characters)
                                                              ( unknown         )
For a 4x20 display:- _!"#$%&'()*+,-./0123
                     `abcdefghijklmnopqrs
                     456789:;<=>?@ABCDEFG
                     tuvwxyz{|}><???????? (last 8 characters unknown)

For a 4x40 character display, first connect PIC pin 7 (Enable) to EN1 of the LCD
to check the top half (display as 2x40), then to EN2 for bottom half.

Note:-
        Any user of this code should be aware the code is provided as is,
        and has not been fully tested to commercial standards.
        
        The author would be grateful for any bug reports, and descriptions
        of the uses this code has been put to.

        
-------------------------------------------------------------------------------  
****************************************************************************
*    All code supplied in 'LCDTEST.ZIP' and the resulting compiled code    *
*               copyright 1993-97 Steve Lawther                            *
****************************************************************************

Use of any of this code requires Steve Lawther to be credited within the
source code.
Any Commercial use of part or all of this code requires the permission of the
author, Steve Lawther, and a payment may be required. For more details
Email 
        100255.157@compuserve.com
--------------------------------------------------------------------------------       

Here ends the legal stuff - Go use the code.
