Tut 5 : LCD 16X2 Display

LCD DISPLAY

 
Liquid crystal display (LCD) is specifically manufactured to be used with microcontrollers for displaying different messages. It is based on the HD44780 microcontroller (Hitachi) and can display messages in two lines with 16 characters each. It displays all the letters of alphabet, Greek letters, punctuation marks, mathematical symbols etc. In addition, it is possible to display symbols made up by the user (custom character generator). Other useful features include automatic message shift (left and right), cursor appearance, LED backlight etc. 


The LCD screen consists of two lines with 16 characters each. Every character consists of 5x8 dot matrix. Some LCD displays have built in backlight (blue or green diodes).


PBP Program
' Example program to display text on LCD screen for 1 second

DEFINE OSC 20            ' using 20MHz clock oscillator
@ device hs_osc

DEFINE LCD_DREG PORTD            'port D data masuk start D.4 hgga D.7
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB                 'port B.4 utk sambungan RS
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB                   'Enable bleh jalan bila guna port B.5
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2

Pause 500                  ' Wait for LCD to start
loop:

LCDOut $fe, 1, "LCD Test"                ' Display first line
LCDOut $FE,$C0, "Hello World"                  ' Display second line
Pause 1000

GoTo loop 

No comments:

Post a Comment