Page 147 - Making PIC Microcontroller Instruments and Controllers
P. 147

USING LIQUID  CRYSTAL DISPLAYS:  AN


                  EXTENDED  INFORMATION  RESOURCE















                  General



                  The  use of LCD (liquid crystal display) modules is covered in great  detail in this chap
                  ter because they folm an important  part of any  project based  on the use of the PIC line
                  of miooprccessors and the PROBASIC PRO compilers.  We will  consider the popular
                  2line-by-  l6-character  display in detail,  but the infomation  is applicable to most LCDS
                  on the market today.
                    The PICBASIC  PRO Compiler offers full suppo  for the 2line-by-20-character
                  display  povided  on the LAB-XI  board,  as well as for other similar displays controlled
                  by the Hitachi HD44780U and compatjble  controllers. Befor€ a display can be used, it
                  is necessary to tell the compiler where the display is located in momory.  This is done
                  by setling the value of a number  of DEFINES that have  been named and  prede{ined  in
                  the compiler These DEFINES  let you wrire to any LCD at any memory location in your
                  prcject  widr the  compiler  (assuming  there are no wiring conflicts). The specific DEFINES
                  related to the control of the LAB-XI  display are as follows:
                    The DEFINES  described next are fo: an LCD confolled  from PORTD and PORTE.
                  as  is  the case for the LAB-XI.
                    Identify the polt connected  to the LCD data  pins:

                   DEFINE       I.CD  DREG     PORTD
                    Decide how  rnany bits of data to use,  along with tlle stafling bit. This can be a 0 or a 4
                  for the data  starting bit, and 4 or 8 for the number  of bits used:
                   DEFINE       IrcD_DBIT      0   ( o !  4 )
                   DEFINE       ICD_BIIFS      4   ( o !  8 )
                    Specifi  the register that will  contain the register selection  bit, and the number oI the
                  bit that will  be used to select the reqister:
                                                                                       r39
   142   143   144   145   146   147   148   149   150   151   152