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 / Liquid level alarm using 8051 microcontroller (AT89C51)

Liquid level alarm using 8051 microcontroller (AT89C51)

|

Projects › Projects › Liquid level alarm using 8051 microcontroller (AT89C51)

  • This topic has 3 replies, 2 voices, and was last updated 13 years, 10 months ago by Mohd Mustaqim.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • October 29, 2011 at 2:15 pm #1360
    Rogen Lee
    Participant

    Hello guys. I just wanna this project. We made this kind of project from hardware down to software. My question is, why is our lcd has no display? It’s just light. The backlight of the lcd. The program is ok when we compile it and convert it to hex. But still can’t display. Please help us so we can pass the project successfully. Thank you.

    November 2, 2011 at 8:22 am #6775
    Rogen Lee
    Participant

    PLEASE help us guys!!!

    November 5, 2011 at 8:06 am #6807
    Rogen Lee
    Participant
    // Program to make a Liquid level indicator using LCD

    #include<reg51.h>

    sbit rs=P1^0; //register select pin

    sbit rw=P1^1; //read/write pin

    sbit e=P1^2; //enable pin

    sbit quat=P3^0; //pin connected to quater level of tank

    sbit half=P3^1; //pin connected to half level of tank

    sbit quat_3=P3^2; //pin connected to three -fourth level of tank

    sbit full=P3^3; //pin connected to full level of tank

    sbit spkr_on=P3^4; 

    sbit spkr_off=P3^5; // pin to off speaker

     

    void delay(int k) //delay function

    {

    int i,j;

    for(i=0;i<k;i++)

      for(j=0;j<1275;j++);

    }

     

    void write(int j) //write function

    {

    rs=1;  //selecting command register

    rw=0;  //selecting to write

    P2=j;  //putting value on the pins

    e=1;  //strobe the enable pin

    delay(1);

    e=0;

    return;

    }

     

    void cmd(int j)  //command function

    {

    P2=j;  //put the value on pins

    rs=0;  //selecting command register

    rw=0;  //selecting to write

    e=1;  //strobe enable pin

    delay(1);

    e=0;

    return;

    }

     

    void puts(char *a) //puts function to print a string

    {

    unsigned int p=0;

    for(;a[p]!=0;p++)

    write(a[p]);

    }

     

    void lcd_init(void) // function to initialise the LCD

    {

    cmd(0x38); //setting 8-bit interface, 2 lines, 5*7 Pixels

    delay(1);

    cmd(0x0e); //turning on underline visible cursor

    delay(1);    

    cmd(0x01); //clearing screen

    cmd(0x80); //moving cursor to the begining of line 1 of LCD

    }

     

    void main()

    {

    quat=half=quat_3=full=spkr_off=1; //configuring as input pins

    quat=half=quat_3=full=spkr_off=0; //lowering input pins

    spkr_on=1;    // making speaker on pin high,as it works on negative logic

    while(1)

    {

      while(quat==0&&half==0&&quat_3==0&&full==0&&spkr_off==0)   //condition when tank is empty

      {

       lcd_init();        // initialising LCD

       puts(“VACANT”);       //printing VACANT on lcd

      }

      while(quat==1&&half==0&&quat_3==0&&full==0&&spkr_off==0)         //condition when tank is quater

      {

       lcd_init();

       puts(“QUATER”);      //printing QUATER on lcd

      }

      while(quat==1&&half==1&&quat_3==0&&full==0&&spkr_off==0)         //condition when tank is half

      {

       lcd_init();     

       puts(“HALF”);      //printing HALF on lcd

      }

      while(quat==1&&half==1&&quat_3==1&&full==0&&spkr_off==0)         //condition when tank is three-fourth

      {

       lcd_init();

       puts(“3/4 FULL”);     //printing 3/4 FULL on lcd

      }

      while(quat==1&&half==1&&quat_3==1&&full==1&&spkr_off==0)         //condition when tank is full

      {

       lcd_init();

       puts(“FULL;CLOSE TAP”);     //printing FULL;CLOSE TAP on lcd

       spkr_on=0;// Enabling speaker

      }

      while(quat==1&&half==1&&quat_3==1&&full==1&&spkr_on==0&&spkr_off==1)//enabling high speaker_off pin

      {

       spkr_on=1;//disabling speaker

      }

    }

    }

     

     

     

    >>here is the code of the liquid alarm project. I hope you can help me. Thank you

    March 13, 2012 at 5:02 am #7293
    Mohd Mustaqim
    Participant

    Can I know if this code really can make with the liquid detector circuit or otherwise, I need to know, someone already tried?

  • 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

  • getting no where fast 8 x 8 led matrix January 23, 2026
  • Expensive hobby January 23, 2026
  • analog logic of shmidt trigger bjt circuit January 22, 2026
  • Micro mouse January 22, 2026
  • Best practices for accurate LiPo battery monitoring on ESP32? January 22, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 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