Skip to main content

social

pop

Interfacing 16x2 LCD with PIC microcontroller

Interfacing a 16X4 LCD

In this project, a 16X2 LCD is connected to PORTB of PIC 16F877A microcontroller and the microcontroller is operated from an 8MHz oscillator. The message to be displayed is "welcome to 16x2 LCD display".
A reset button is include to be able to reset the microcontroller.

The circuit is drawn using proteus software and the code below is written in mikroC PRO for PIC.

 Circuit diagram of a 16X2 LCD

interfacing LCD

MikroC code of 16X2 LCD display
 // begin configuration of LCD
sbit LCD_RS_direction at TRISB0_bit;
sbit LCD_EN_direction at TRISB1_bit;
sbit LCD_D4_direction at TRISB2_bit;
sbit LCD_D5_direction at TRISB3_bit;
sbit LCD_D6_direction at TRISB4_bit;
sbit LCD_D7_direction at TRISB5_bit;

sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
// End of LCD configuration

void main() { char txt[]="welcome to 16x2"; char text[]="LCD display";

TRISB=0X00;                                  // Configure PORTB as output
PORTB=0X00;                                 // initialise PORTB
while(1)                                   // loop
{
lcd_Init();                              //  initialise LCD
lcd_cmd(_lcd_clear);                    //  clear the LCD
lcd_cmd(_lcd_cursor_off);              // put OFF the cursor on LCD
delay_ms(100);                        // delay for 0.1 second
lcd_out(1,1,txt);                    // display "welcome to 16x2" on row 1 of LCD
lcd_out(2,3,text);                 // display "LCD display"; on row 2 column 3
delay_ms(1500);                    // delay for 1.5 seconds

}
}


By EKETECH

Related:

Popular posts from this blog

How to Install Proteus 8 Professional: A Step-by-Step Guide

 How to Install Proteus 8 Professional: A Step-by-Step Guide Proteus 8 Professional is a powerful tool for electronic circuit design and simulation. Whether you’re a student, hobbyist, or professional engineer, following a clear installation process ensures you get started without headaches. Are you ready to start designing and simulating electronic circuits with Proteus 8 Professional!   Here’s a comprehensive, guide to installing Proteus 8 Professional on your Windows PC. Step 1: Download the Installer ·        Visit the official Labcenter Electronics website or another trusted source to download the Proteus 8 Professional installer. Avoid unofficial sources to prevent malware or corrupted files . You can download from HERE DOWNLOAD PROTEUS AND ARDUINO ·        The installer typically comes as a ZIP file. Wait for the download to finish and locate it in your Downloads folder Step 2: Extract the Installer...

2023 2024 Official Textbook List for General Secondary Education in Cameroon

 2023-2024 Official Textbook List for Secondary Schools in Cameroon OFFICIAL TEXTBOOK LIST 2023/2024 Academic Year General Secondary Education: First and Second Cycles NB: Only textbooks on the official list bearing the seal of State as signed by the minister of secondary education are required of students in all public and private schools throughout the national territory FORM 1  ENGLISH LANGUAGE Title: Mastering English      Price: 3400 LITERATURE IN ENGLISH Tales From the Grassland and the Forest (Prose)   price: 2000 A questionable Culture (Drama)   Price: 1000 Authentic Poetry (Book 1)    Price: 2000 FRENCH LANGUAGE Title: Le Reseau du Français   Price: 3200 HISTORY Title: Essential History for Junior Secondary Schools    Price: 2000 GEOGRAPHY Title: Geography for Competency Development: A functional Approach to Geography Study    Price: 4000 CITIZENSHIP Title: Brighter ...

Download HND Past Questions and Solutions

Download Cameroon HND Past Questions & Solutions Boost your exam prep with past papers and answers across all fields! How to Access Past Questions Visit the Cameroon HND Platform or trusted sites like EKETECH . Browse by field : Select your program (e.g., Civil Engineering , Banking and Finance , Nursing ). Download PDFs for free or via subscription. Practice with solutions : Review answers to refine your understanding. Fields of Study Covered Past questions are available for all HND programs in Cameroon, including: Engineering Civil Engineering Design Software Engineering Electrical Power Systems Telecommunication Mechanical Engineering Computer Engineering Medical Sciences Nursing Medical Laboratory Studies Health Care Management Physiotherapy Nutrition and Dietetics Agriculture Agribusiness Management Agricultural Engineering Food Technology Integrated Agriculture Business Accounting Banking and...