EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / PROBLEM RELATED TO LCD……

PROBLEM RELATED TO LCD……

|

Microcontroller › 8051 › PROBLEM RELATED TO LCD……

  • This topic has 3 replies, 3 voices, and was last updated 13 years, 2 months ago by AJISH ALFRED.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • April 2, 2012 at 7:26 pm #1531
    Ashish Chakole
    Participant

     HI FRIENDS,

     

    i have interfaced lcd n gsm module with 89c51, everything is working fine right from the pin voltage but i m facing a different problem. according to the program lcd should immediately or with a small delay, display the required string aftre detecting an input. but whenever i give an input via any of three input pins, lcd do not show anything, but when i toch the pins of 89c51, it statrts showing the required string. i cant understant wat may b the problem. even i have checked for the loose connections, but dint get any such……

     

    here i m writing my code………

    also can anyone suggest me the correction in “AT Commands” given in following program, if any…….

     

    Description:

    if 89c51 gets an input on one of three pins, it will send a msg through gsm module also it will print corrosponding msg on LCD

     

    #include<at89x51.h> // include at89x51 . h
    #include<stdio.h> // include stdio . h
    #include<stdlib.h> // include stdlib . h

    void initialize_GSM_modem(void);
    void initialize_serialcommunication(void);

    unsigned int counterup = 0;
    unsigned char Command_AT[]=”ATr”;
    unsigned char Command_CMGF[]=”AT+CMGF=1r”;
    // AT+CMGF for selecting Text Mode
    unsigned char Command_CMGS[]=”AT+CMGS =9870743470r”;
    // recepient mobile number
    unsigned char msg02[]=”Hello!”;
    unsigned char CtrlZ=0x1A;
    // CTRL+Z for sedning SMS after the message has been entered

    // inputs
    // if any of the push button is pressed logic zero will be detected by microcontroller on respective input pin
    sbit input_seal = P1^0;
    sbit input_magnet = P1^1;
    sbit input_reverse = P1^2;

    sfr lcd_data_pin=0xA0;  // data port P2
    sbit rs=P0^0; // Register select pin
    sbit rw=P0^1; // Read write pin
    sbit en=P0^2; // Enable pin

    // outputs
    // coresponding output will be generated by applying logic one on respective output pin
    sbit flashing = P3^6;
    sbit alarm = P3^7;

    void delay(unsigned int msec)    //delay function
    {
    int i,j;
    for(i=0;i<msec;i++)
    for(j=0;j<1275;j++);
    }
    void lcd_command(unsigned char comm) // function to send command to LCD
    {
    lcd_data_pin=comm;
    en=1;
    rs=0;
    rw=0;
    delay(1);
    en=0;
    }
    void lcd_data(unsigned char disp)    // function to send data on LCD
    {
    lcd_data_pin=disp;
    en=1;
    rs=1;
    rw=0;
    delay(1);
    en=0;
    }

    lcd_dataa(unsigned char *disp)    // function to send string to LCD
    {
    int x;
    for(x=0;disp[x]!=0;x++)
    {
    lcd_data(disp[x]);

    }
    }

    void lcd_ini()     //Function to initialize the LCD
    {
    lcd_command(0x38);   
    delay(5);
    lcd_command(0x0F);       
    delay(5);
    lcd_command(0x80);
    delay(5);
     

    }

    void delay2(void)
    {
    unsigned int i;
    for(i=0;i<25000;i++);
    }

    void main (void)
    {
    P1 =0xff;
    P2 = 0;
    alarm = 0;
    flashing = 0;
    initialize_serialcommunication();
    initialize_GSM_modem();

    while (1)
     {
    flashing =~ flashing;
    delay2();

    if(input_seal == 0)
    {
    lcd_ini();
    lcd_dataa(”   Seal is    ” );
    lcd_command(0x0C0);
    lcd_dataa(”    broken     “);
     
    alarm = 1;
    puts(“Seal is Broken”);
    delay2();
    while(!TI);
    TI = 0;
    SBUF = 0x1A;
    }

    if(input_magnet == 0)
    {
    lcd_ini();
    lcd_dataa(”   Magnet is  ” );
    lcd_command(0x0C0);
    lcd_dataa(”   detectecte  “);

    alarm = 1;
    puts(“Magnet is Detected”);
    delay2();
    while(!TI);
    TI = 0;
    SBUF = 0x1A;
    }

    if(input_reverse == 0)
    {
    lcd_ini();
    lcd_dataa(”   Current   “);
    lcd_command(0x0C0);
    lcd_dataa(”   reversal   “);
     
    alarm = 1;
    puts(“Current reversal”);
    delay2();
    while(!TI);
    TI = 0;
    SBUF = 0x1A;
    }

    if(alarm == 1)
    {
    counterup++;
     if(counterup>=2)

    {

    counterup = 0; alarm = 0; P2=0;}
    }
    }
    }

    void initialize_GSM_modem(void)
    {
    delay2();
    puts(Command_AT);
    delay2();
    puts(Command_CMGF);
    delay2();
    puts(Command_CMGS);
    delay2();
    puts(msg02);
    delay2();
    while(!TI);
    TI = 0;
    SBUF = 0x1A;
    }

    void initialize_serialcommunication(void)
    {
    TMOD = 0x20;
    SCON = 0x50;
    TH1 = 0xFD;
    TL1 = 0xFD;
    TR1 = 1;
    TI = 1;
    }

     

     

    thanx

    April 3, 2012 at 5:28 am #7384
    Harsh Pandya
    Participant

    This simply means that your controller pins are not properly in contact with the socket (if you are using one)

    April 4, 2012 at 1:08 pm #7391
    Ashish Chakole
    Participant

    thanx……….

     

    April 20, 2012 at 1:24 pm #7521
    AJISH ALFRED
    Participant

    What kind of power supply are you using. Always use central tapped transformer based regulated rectifier to avoid this kind of issues.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Simple LED Analog Clock Idea July 7, 2025
  • The Analog Gods Hate Me July 7, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz July 7, 2025
  • PIC KIT 3 not able to program dsPIC July 7, 2025
  • Parts required for a personal project July 6, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise