Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '--------------------------------------------------------------
  2. '                 (c) 1997,1998 MCS Electronics
  3. '--------------------------------------------------------------
  4. '  file: LCD.BAS
  5. '  demo: LCD, CLS, LOWERLINE, SHIFTLCD, SHIFTCURSOR, HOME
  6. '        CURSOR, DISPLAY
  7. '--------------------------------------------------------------
  8. $sim
  9. Dim A As Byte
  10. Config Lcd = 16 * 2                                         'configure lcd screen
  11. 'other options are 16 * 4 and 20 * 4, 20 * 2
  12. 'When you dont include this option 16 * 2 is assumed
  13.  
  14. '$LCD = address will turn LCD into 8-bit databus mode
  15. '       use this with uP with external RAM and/or ROM
  16. '       because it aint need the port pins !
  17.  
  18. Cls                                                         'clear the LCD display
  19. Lcd "Hello world."                                          'display this at the top line
  20. Wait 1
  21. Lowerline                                                   'select the lower line
  22. Wait 1
  23. Lcd "Shift this."                                           'display this at the lower line
  24. Wait 1
  25. For A = 1 To 10
  26.    Shiftlcd Right                                           'shift the text to the right
  27.    Wait 1                                                   'wait a moment
  28. Next
  29.  
  30. For A = 1 To 10
  31.    Shiftlcd Left                                            'shift the text to the left
  32.    Wait 1                                                   'wait a moment
  33. Next
  34.  
  35. Locate 2 , 1                                                'set cursor position
  36. Lcd "*"                                                     'display this
  37. Wait 1                                                      'wait a moment
  38.  
  39. Shiftcursor Right                                           'shift the cursor
  40. Lcd "@"                                                     'display this
  41. Wait 1                                                      'wait a moment
  42.  
  43. Home Upper                                                  'select line 1 and return home
  44. Lcd "Replaced."                                             'replace the text
  45. Wait 1                                                      'wait a moment
  46.  
  47. Cursor Off Noblink                                          'hide cursor
  48. Wait 1                                                      'wait a moment
  49. Cursor On Blink                                             'show cursor
  50. Wait 1                                                      'wait a moment
  51. Display Off                                                 'turn display off
  52. Wait 1                                                      'wait a moment
  53. Display On                                                  'turn display on
  54. '-----------------NEW support for 4-line LCD------
  55. Thirdline
  56. Lcd "Line 3"
  57. Fourthline
  58. Lcd "Line 4"
  59. Home Third                                                  'goto home on line three
  60. Home Fourth
  61. Home F                                                      'first letteer also works
  62. Locate 4 , 1 : Lcd "Line 4"
  63. Wait 1
  64. Cls
  65. 'Now lets build a special character
  66. 'the first number is the characternumber (0-7)
  67. 'The other numbers are the rowvalues
  68. 'Use the LCD tool to insert this line
  69. Deflcdchar 0 , 31 , 17 , 17 , 17 , 17 , 17 , 31 , 0         ' replace ? with number (0-7)
  70. Deflcdchar 1 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 31        ' replace ? with number (0-7)
  71. Lcd Chr(0) ; Chr(1)                                         'print the special character
  72.  
  73. '----------------- Now use an internal routine ------------
  74. Acc = 1                                                     'value into ACC
  75. Call Write_lcd                                              'put it on LCD
  76. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement