Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to use delay function??

Status
Not open for further replies.

ru

Junior Member level 1
Joined
Sep 30, 2004
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
168
how to write the delay function for the purpose of making the alarm trigger after 2 secs when the sensor detecting an object??
 

It depneds about the micorcontroller which you use and alos about the frequesncy.
Check
**broken link removed**
 

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
 

you can make timeout routines with the use of timer module
 

Ahmed Ragab said:
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

okie... thanks a lot.. but can you post your program for me here to have a look if you still having it?? pls...
 

sztibi82 said:
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


sorry.. why i cant find the server for this link?
 

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 :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top