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 / first make alarm=0then when

first make alarm=0then when

|

Microcontroller › 8051 › LASER SECURITY › first make alarm=0then when

April 5, 2014 at 1:30 pm #11471
Ashutosh Bhatt
Participant

first make alarm=0

then when ur ldr becomes 0 – make it alarm = 1.

dont make alarm = 0 aferwards

 

when anyone presses manual reset the alarm will be 0 again

#include<reg51.h>
sbit alram=P2^2;
sbit ldr =P3^2;
void delay (unsigned char msec)
{
unsigned int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void main(void)
{

alarm = 0

while(ldr==1);

 

//if(ldr==1)
//{
//alram=0;

//}
//else
//{
alram=1;
delay(2000);
//}
}

 

 

RSS Recent Posts

  • Assistance locating a 'trail' camera gadget, please ? May 16, 2026
  • reviving old swordfish program but? May 16, 2026
  • Analog multiplexer has gone obselete May 16, 2026
  • Difference between TTL, RS232 and RS485 May 16, 2026
  • Smart Buoy project May 16, 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