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 / Replies /  the motor is turning on at

 the motor is turning on at

|

Microcontroller › AVR › water level controller ›  the motor is turning on at

August 2, 2011 at 9:07 am #6558
Maneesh PK
Participant

 

the motor is turning on at lower level. but it is not getting off. it is getting stuck inside the while loop…

 

while(1)
        {
                adc_init();
                adcout=adc_getvalue(0);
                _delay_ms(1);
                LCD_cmd(0xc0);
                char ready[50];
                itoa(adcout,ready,10);
                LCD_write_string(ready);
                LCD_write_string(“%   “);
                _delay_ms(1);
 

               PORTD=0xF0;        //set all the input to one
               value=PIND;        //get the PORTD value in variable “value”      

              if(value!=0xf0)        //if no key is pressed value changed
               

               {
                key=’0′;
               
                check1();
                check2();
                check3();
                check4();

                if (key==’M’)
                    {
                    Menu();
                    }
               
                else if (key==’0′)
                        {
                       
                        }
           
                else
                    {
                    ctrl=(1<<buzz);
                    _delay_ms(100);
                    ctrl=(0<<buzz);
                    _delay_ms(1);
                   
                    }

                }

            if (adcout<00001010)
                {

                while (adcout<=00101100)
                    {
                    ctrl=(1<<motr)|(1<<led);
                    _delay_ms(1);
                    adc_init();
                    adcout=adc_getvalue(0);
                    _delay_ms(1);

                   
                    }
                    ctrl=(0<<motr)|(0<<led);
                    }

            else
                {
                    ctrl=(0<<motr)|(0<<led);
                   
                }
}

}

 

if motor is once turned on, i should have to reset to turn it off even after lelev cross higher level

 

pls help

RSS feed: Recent Posts Recent Posts

  • Advice for an ESP32 Soil Tensiometer project with 5V sensors September 9, 2026
  • Marantz SR4500 – CS49400 DSP reverse-engineering / custom active crossover September 9, 2026
  • How does an air tag work? September 9, 2026
  • Cheap ways to link 5 Keithley units and 4 BNC units? September 8, 2026
  • Sony KV-29VL40 - 4 Blink error - IC001 Pin 17 high September 8, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 Arrowfly 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 Arrowfly
Privacy Policy | Advertising

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