How to interface a 16*4 LCD with PIC18F452 with codes


Over the past week I am puzzled that how to interface a lcd with pic18f452 microcontroller atlast i got it working

Softwares Used

1. mikroc for pic pro
2. proteus vsm simulator (demo version)

Hardwares Used

1. 16*4 LCD
2. PIC18F452
3. 8Mhz Crystal Oscillator
4. and resistors, capacitors, power supply etc.

The Following is the schematic


The Following is the working code


LCD
sbit Lcd_RS at RA0_bit;
sbit Lcd_EN at RA2_bit;
sbit Lcd_D7 at RB7_bit;
sbit Lcd_D6 at RB6_bit;
sbit Lcd_D5 at RB5_bit;
sbit Lcd_D4 at RB4_bit;
sbit Lcd_D3 at RB3_bit;
sbit Lcd_D2 at RB2_bit;
sbit Lcd_D1 at RB1_bit;
sbit Lcd_D0 at RB0_bit;
sbit Lcd_RS_Direction at TRISA0_bit;
sbit Lcd_EN_Direction at TRISA2_bit;
sbit Lcd_D7_Direction at TRISB7_bit;
sbit Lcd_D6_Direction at TRISB6_bit;
sbit Lcd_D5_Direction at TRISB5_bit;
sbit Lcd_D4_Direction at TRISB4_bit;
sbit Lcd_D3_Direction at TRISB3_bit;
sbit Lcd_D2_Direction at TRISB2_bit;
sbit Lcd_D1_Direction at TRISB1_bit;
sbit Lcd_D0_Direction at TRISB0_bit;
// End Lcd8 module connections

char * text;

void main(){
    ADCON1 |= 0x07;
    TRISA = 0;
    INTCON = 0;
    INTCON1 = 0;
    INTCON2 = 0;
    CCP2CON = 0;
    TRISB=0;
    Delay_ms(2000);
Lcd_Init();
Delay_ms(2000);
Lcd_Cmd(_Lcd_CLEAR);
//Lcd_Cmd(_Lcd_CURSOR_OFF);
Delay_ms(2000);
text = "WWW.ANDRIL.IN"    ;
Lcd_Out(1,1,text);
Delay_ms(2000);
text = "BLOG.KATHIR.CO.IN"    ;
Lcd_Out(1,1,text);
    }

The above code works only when lcd library in mikroc is enabled
it works only with mikroc
/ Test these codes at your own risk. we are not responsible for any malfunctions/


Share on Google Plus

About Kathiravan

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

2 comments:

  1. A Liquid Crystal Display (LCD) is one of the most enduring and fundamental technologies used in most monitors, televisions, tablets and smartphones. TVs and other monitors used to use cathode ray tubes (CRTs) to provide the image onto the screen. Once LCD displays became affordable they quickly displaced the bulky CRTs. https://www.stoneitech.com/about/news/sharing/assemble-lcd-module.html

    ReplyDelete
  2. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Project Centers in Chennai.

    Software management seeks for decision support to identify technologies like JavaScript that meet best the goals and characteristics of a software project or improvement programme. JavaScript Training in Chennai Accessible experiences and repositories that effectively guide that technology selection are still lacking.

    Aim of technology domain analysis is to describe the class of context situations (e.g., kinds of JavaScript software projects) in which a software engineering technology JavaScript Training in Chennai can be applied successfully

    ReplyDelete