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 / water level indicator using 8051

water level indicator using 8051

|

Microcontroller › 8051 › water level indicator using 8051

  • This topic has 8 replies, 6 voices, and was last updated 10 years, 7 months ago by Ashutosh Bhatt.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • April 21, 2013 at 6:40 am #2283
    mehul
    Participant

    respected sir ,

    when i try to convert program for this project it shows two error

    1  syntax error

    2  end missing error

    plz sir help me

    i want to make this project

     

    program

     

    #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
      }
    }
    }

     

    April 21, 2013 at 6:51 am #9549
    AJISH ALFRED
    Participant

    Hi Mehul,

    Please find the line at which the error indicates and share it with us. Please copy paste the entire error report here.

    July 27, 2013 at 8:14 am #10227
    vivek dilipbhai nandha
    Participant

    respected sir,

      I am student of 5th ec and i want to make one mini project based on 8051.

    I  found project named it “water level indicator”

    but there is one problem in it. It programming is given in “c” language. So, can you tell me how to convert “c” programming into assambaly language like 8051.

    July 29, 2013 at 4:50 am #10231
    AJISH ALFRED
    Participant

    Hi Vivek,

    Most of the programming softwares have an assembly viewer. I guess the Keil also has the same facility. Once you compile the code in C, you can view the assembly code of the same.

    August 1, 2013 at 2:56 pm #10255
    vivek dilipbhai nandha
    Participant

    Thank you sir for your reply 

     

    and i will imliment this……..

     

     

     

    September 21, 2013 at 6:42 am #10472
    nikita surti
    Participant

    respected sir,

                        

                         I am a student of 5th sem ec I want the program for water level indicator using 8051 plz help me  by getting this.

     

                  waiting for ur reply.

    September 23, 2013 at 4:50 am #10476
    AJISH ALFRED
    Participant

    Hi Nikita,

    There are so many examples in the site under the electronic circuits section, here are few links;

    http://www.engineersgarage.com/electronic-circuits/water-level-controller-cum-indicator

    http://www.engineersgarage.com/electronic-circuits/water-level-indicator-with-display

    http://www.engineersgarage.com/electronic-circuits/water-level-indicator-display-gates

    http://www.engineersgarage.com/electronic-circuits/water-sensor

    http://www.engineersgarage.com/electronic-circuits/tank-full-alarm-circuit

    September 27, 2014 at 6:40 am #12232
    Gautam Shrivastav
    Participant

    Can u plzzz post d embedded c code for water level indicator using 8051 and seven segment display

    September 28, 2014 at 11:41 am #12234
    Ashutosh Bhatt
    Participant

    just go through the links

    you might get everything.

    try to troubleshoot program code errors yourself. thats the way of learning

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

RSS Recent Posts

  • LED circuit for 1/6 scale diorama May 15, 2025
  • stud mount Schottky diodes May 15, 2025
  • Hi Guys May 15, 2025
  • using a RTC in SF basic May 14, 2025
  • Can I use this charger in every country? May 14, 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