Well I used this idea before ,.. and i guess it will work good enough on any micrcontroller
1-let the alarm sensor trigger an interrupt to the micrcontroller ...
2-this interrupt may itself trigger the timer or counter in the controller to work.
3- adjust the counter u use to enable the alarm circuit u got
The only thing you will need is to calculate the value the counter will trigger the alarm after .. this will depend on the crystal frequency you use
Hai
The easiest thing to use will be the classic Delay routine.If your controller has no other busy tasks you can simplify things by following that method.
just load a variable with the maximum number it can hold and decriment until 0. If you are in C normally an integer will do.
If you are in assembly try doing three nested loops.It will normally give you sufficient delay.The outmost loop variable can be used for varying the dalay.
Good luck
Picstudent
Well I used this idea before ,.. and i guess it will work good enough on any micrcontroller
1-let the alarm sensor trigger an interrupt to the micrcontroller ...
2-this interrupt may itself trigger the timer or counter in the controller to work.
3- adjust the counter u use to enable the alarm circuit u got
The only thing you will need is to calculate the value the counter will trigger the alarm after .. this will depend on the crystal frequency you use
It depneds about the micorcontroller which you use and alos about the frequesncy.
Check
h**p://www.boondog.com/%5Ctutorials%5Cpic16F84%5Cpic16f84.html#timer1_0
For me i will try to use interrupt, then activate using state machine. In state machine, every 10ms check the status til 2sec then trigger alarm...
Here is jz my idea, mayb u can try it