An HD44780 Character LCD is a liquid crystal display (LCD) display device designed for interfacing with embedded systems. These screens come in a variety of configurations including 8x1, which is one row of eight characters, 16x2, and 20x4. The most commonly manufactured configuration is 40x4 characters, which requires two individually addressable HD44780 controllers with expansion chips as the HD44780 can only address up to 80 characters.
These LCD screens are limited to text only and are often used in copiers, fax machines, laser printers, industrial test equipment, networking equipment such as routers and storage devices. Character LCDs can come with or without backlights, which may be LED, fluorescent, or electroluminescent. Character LCDs use a standard 14-pin interface and those with backlights have 16 pins. The pinouts are shown in figure below.
The software is here:
/*
* Project name:
Test LCD in 4-bit mode
* Description:
This code demonstrates how to display test message on a LCD which
is connected to PIC16F628A through PORTB. D4-D7 pins of LCD are
connected to RB4-RB7, whereas RS and EN pins connected to RA0 and RA1
respectively.
MCU: PIC16F628A
Oscillator: XT, 4.0 MHz
*/
// LCD module connections
sbit LCD_RS at RA0_bit;
sbit LCD_EN at RA1_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISA0_bit;
sbit LCD_EN_Direction at TRISA1_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections
// Define Messages
char message1[] = "Testing LCD";
char message2[] = "using PIC16F628A";
char message3[] = "Test Successful!";
char message4[] = "2009/09/18";
void main() {
CMCON |= 7; // Disable Comparators
Lcd_Init(); // Initialize LCD
do {
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,message1); // Write message1 in 1st row
Lcd_Out(2,1,message2); // Write message1 in 2nd row
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Out(1,1,message3); // Write message3 in 1st row
Lcd_Out(2,1,message4);
Delay_ms(2000);
} while(1);
}
* Project name:
Test LCD in 4-bit mode
* Description:
This code demonstrates how to display test message on a LCD which
is connected to PIC16F628A through PORTB. D4-D7 pins of LCD are
connected to RB4-RB7, whereas RS and EN pins connected to RA0 and RA1
respectively.
MCU: PIC16F628A
Oscillator: XT, 4.0 MHz
*/
// LCD module connections
sbit LCD_RS at RA0_bit;
sbit LCD_EN at RA1_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISA0_bit;
sbit LCD_EN_Direction at TRISA1_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections
// Define Messages
char message1[] = "Testing LCD";
char message2[] = "using PIC16F628A";
char message3[] = "Test Successful!";
char message4[] = "2009/09/18";
void main() {
CMCON |= 7; // Disable Comparators
Lcd_Init(); // Initialize LCD
do {
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,message1); // Write message1 in 1st row
Lcd_Out(2,1,message2); // Write message1 in 2nd row
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Out(1,1,message3); // Write message3 in 1st row
Lcd_Out(2,1,message4);
Delay_ms(2000);
} while(1);
}
0 comments:
Post a Comment