I want to build a project with relay,switch and 8051
my logic is as below
- when pressed Switch Start Relay
- wait for pulse 60 seconds,
- if pulse there withing 60 sec then continuous on relay,
if no pulse then wait another 60 sec
- after 120 second if no pulse then make relay off and again check for switch pressed
If there is pulse between 60 and 120 second ? Where does the pulse come from ? Is it actually a pulse or some low to high transition which remains in high state after transmission ?
Edit: If pulse is detected between 60 and 120 sec then Relay is turned ON ?
Use interrupt concept for detecting pulse, update the timer value with 60. Decrement the timer value in the while loop, when the timer goes zero switch off the relay.
Here is the Keil C51 Code for AT89C51. INT0 is switch and button not pressed state is high. Button has to be pressed and released. Pulse has to go high and then low.