- This topic has 1 reply, 2 voices, and was last updated 9 years, 12 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › LASER SECURITY
Sir,
I have made laser security system using LM339(comprator) with AT89S51 but problem is that the when interrupt is accure to controller then the alram is ON for short time
pls send me c code in which alram will on until manualy reset it
I am using following code
#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)
{
if(ldr==1)
{
alram=0;
}
else
{
alram=1;
delay(2000);
}
}
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);
//}
}