- This topic has 2 replies, 3 voices, and was last updated 10 years, 12 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
|
Sir,
I have made laser security system using LM339(comprator) with AT89S51 but problem is that the when interrupt is accure the alram 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);
}
}
Thank you
Please post your C code here so that we can suggest the necessary edits. Loooking from your problem, u have to change the delay time or add an infinite while loop in you interrupt service routine. For eg:
ISR_function()
{
<switch on alarm>;
while(1);
}
The above function will switch ON the alarm and go into and infinite loop out which the controller comes only after reset button is pressed.
its very simple
in main function switch off buzzer initially.
in ur ISR just switch it ON. dont switch off.
when reset is pressed manually again main function is called so buzzer will be off.