' ********************************************************************** ' ** Program name: LCD51.BAS - Version : 1.1 - 19 May 2000 ** ' ** Compiler : BASCOM LT Demo, (IDE V.1.21, LIB V.1.28) ** ' ** Board : K51-AVR ** ' ** Firm: grifo(r) ITALIAN TECHNOLOGY ** ' ** Via Dell' Artigiano 8/6 40016 San Giorgio di Piano (BO) ** ' ** Tel.+39 051 892 052 Fax +39 051 893 661 ** ' ** http://www.grifo.com http://www.grifo.it ** ' ** sales@grifo.it tech@grifo.it grifo@grifo.it ** ' ** ** ' ** Written by: Adriano Pedrielli ** ' ********************************************************************** ' ' This program allows to manage an alphanumeric LCD featuring a number ' rows and columns definible bythe User. ' The display must be connected to CN5 following the connections shown ' in the diagram of K51-AVR page 4 of 4. ' ' Before compiling select in menu Option/Compiler/Misc/ : ' Byte End 5F, Register File REG51.DAT ' In menu Option/ LCD select: ' Db4 = P1.5 , Db5 = P1.6 , Db6 = P1.7 , Db7 = P1.2 , E = P1.4 , Rs = P1.3 ' '*********************************************************************** ' '********************* Compiler Directives ***************************** ' $romstart = &H0 ' code start address $crystal = 11059200 ' micro clock frequence Config Lcdbus = 4 ' Lcd managed using 4 bits Config Lcd = 20 * 4 ' Lcd with 20 columns 4 rows ' Following declaration can be used only under BASCOM 8051 ' Config Lcdpin = Pin , Db4 = P1.5 , Db5 = P1.6 , Db6 = P1.7 , Db7 = P1.2 , E = P1.4 , Rs = P1.3 Deflcdchar 0 , 253 , 245 , 249 , 245 , 245 , 225 , 226 , 252 ' (R) "registered" character, created using LCD Designer in menu Edit. ' '*********************** Variables declaration ************************* ' Dim A As Byte ' general purpose variable '*************************** Main program ****************************** ' Main: Cls ' LCD clear screen Lcd "Grifo" ' show string Lcd Chr(0) ; ' show (R) character Lcd " www.grifo.com" ' show string Locate 2 , 1 ' cursor in row 2 column 1 Lcd "Tel.+39051892052" ' show string Wait 1 ' delay 1 second For A = 1 To 10 ' repeat 10 times Shiftlcd Right ' right shift display screen Waitms 255 ' delay 255 ms Next For A = 1 To 10 ' repeat 10 times Shiftlcd Left ' left shift display screen Waitms 255 ' delay 255 ms Next Thirdline ' place cursor in row 3 Lcd "Line 3" ' vshow string Fourthline ' place cursor in row 4 Lcd "Line 4" ' show string Do Loop ' infinite loop End ' '**************************** Program end ******************************** '