11/29/2013

EXAMPLE 04 : LCD 1602

 EXAMPLE_04.bas

$regfile = "89s8252.dat"
$crystal = 11059200
Dim I As Byte
Dim X As Byte
Dim A As String * 1

Config Lcdpin = Pin , Db4 = P0.4 , Db5 = P0.5 , Db6 = P0.6 , Db7 = P0.7 , E = P2.2 , Rs = P2.0,
Config Lcd = 16 * 2

P2.1 = 0
Lcdinit
Cursor Off

Do

 Part0:
 Cls
 Restore Db
 Lcd "   Welcome To"
  For I = 3 To 15
  Read A
  Locate 2 , I
  Lcd A
  Waitms 500
 Next I
 Wait 1


Part1:
 Cls
 Wait 1
 Lcd "BASCOM-8051"
 Lowerline
 Wait 1
 Lcd "     BASCOM-8051"
 Wait 1

Part2:
 Cls
 Locate 1 , 6
 Wait 1
 Lcd "BASCOM-8051"
 Locate 2 , 1
 Wait 1
 Lcd "BASCOM-8051"
 Wait 1

Part3:
 Cls
 Lcd "BASCOM-8051"
 Lowerline
 Lcd "BASCOM-8051"

 Shiftlcd Right
 Wait 1
 Shiftlcd Right
 Wait 1

 Shiftlcd Left
 Wait 1
 Shiftlcd Left
 Wait 1

Part4:
 For I = 1 To 20
  Cls
  X = 1 + Rnd(6)
  Locate 1 , X
  Lcd "BASCOM-8051"
  Waitms 500
  Cls

  X = 1 + Rnd(6)
  Locate 2 , X
  Lcd "BASCOM-8051"
  Waitms 500
 Next I

Loop


Db:
Data "B" , "A" , "S" , "C" , "O" , "M" , "-" , "8" , "0" , "5" , "1" , " " , "!"

End