Want A door open and close using 8051

Status
Not open for further replies.

friendchooser

Newbie level 5
Joined
Mar 25, 2011
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,341
I want to open a door to be opened with 89c51 as after 90 degree the motor should be of automatically and after A smaalll delay it should close the door
Code:
#include <reg51.h>
void MSDelay(unsigned int);
void main(void)
{


P1=0x55;
MSDelay(15);
P1=0xAA;
MSDelay(15);

}
void MSDelay(unsigned int itime)
{
unsigned int i,j;
for (i=0;i<itime;i++)
for (j=0;j<80;j++);
}



this is the circuit i am using and the motor does not stops
plz give an urgent suggestion or ammendments in the code

---------- Post added at 01:26 ---------- Previous post was at 01:25 ----------

The frequency i am giving is through the microcontroller
 

you need to tell us when the door would be open so that we can add a condition in your program.... in short we need little more info about your project
 

when the person enters his face will be detected and the door open automatically and after some delay the door will be closed
 

okay...take this example.. you will have basic Idea based in this example..

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void main()
{
   face_detected = 0;
   door_open = 0;
  while(1)
 {
    if(face_detected == 1)
     {
         door_open = 1
         delay_sec(5); 
         face_detected = 0   
     }
     door_close = 1;
 }
}

 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…