'-------------------------------------------------------------------------------- 'name : GLCD_LM6063_example.bas 'purpose : Graphic LCD control example 'micro controller : Mega168 ' 'GLCD : Topway LM6063CFW (Kyohritsu-Digit) ' 128 x 64 dots, monochrome. ' (EPSON SEDxxxx controller) '-------------------------------------------------------------------------------- ' Rem Used ports '-------------------------------------------------------------------------------- ' PD0-7 : LCD D0-7 ' Data port must be settled into one 8-bit port. ' In the above case, PortD. ' PC0 : LCD A0 ' PC1 : LCD /RD ' PC2 : LCD /WR ' PC3 : LCD /CS ' PC4 : LCD /Res ' Control lines must be settled into the same port. ' In the above case, all control lines are set to PortC. '-------------------------------------------------------------------------------- $regfile = "m168def.dat" $crystal = 8000000 ' 8MHz internal clock $hwstack = 32 $swstack = 32 $framesize = 40 $lib "glcdSED.lbx" ' This library must be included to support SEDxxxx chip. ' The library is in the LIB folder of BASCOM. Rem type definition of variables Dim I As Integer , J As Integer Dim X As Single , Y As Single Rem initialize GLCD Config Graphlcd = 128 * 64sed , Dataport = Portd , Controlport = Portc , Ce = 3 , Cd = 0 , Wr = 2 , Rd = 1 , Reset = 4 , Mode = 8 ' add "sed" just after 128 * 64 to indicate SEDxxxx chip use. Setfont Font8x8 ' SEDxxxx chip does not contain the character ROM. ' Therefore BASCOM supports char. pattern. ' The char. pattern is included by $include command at the last of the program, ' after the "END" message. (See the last part of this program.) ' The above message points the top of the char. pattern label. ' clear LCD screen Cls ' The followings are special to Topway LM6063 GLCD. ' For the detail, see the manual of LM6063. Glcdcmd &B1010_0111 ' reverse display ' Glcdcmd BASCOM command is used to send a command-byte to the GLCD controller. ' print t, Y char Lcdat 8 , 65 , "t" Lcdat 4 , 9 , "Y" ' print a string Lcdat 8 , 33 , "LM6063" ' Draw lines Line(27 , 1) -(27 , 52) , 1 Line(28 , 26) -(128 , 26) , 1 Rem Many other command for GCLD control are supported by BASCOM. End ' ASCII font: 8x8 dots ' The following message read and set a char. pattern into the program-flush. $include "font8x8.font"