Skip to content

Commit 099f693

Browse files
authored
Add files via upload
1 parent 596fd0c commit 099f693

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Relay_Interface/Relay.c

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// This is a c code for Relay Interfacing with 8051 microcontroller
2+
3+
#include<reg52.h>
4+
5+
sbit relay = P3^1;
6+
7+
void ms_delay(unsigned int time);
8+
void main()
9+
{
10+
while(1)
11+
{
12+
relay = 1;
13+
ms_delay(5000); // 5 sec delay
14+
relay=0;
15+
ms_delay(5000);
16+
}
17+
}
18+
19+
void ms_delay(unsigned int time)
20+
{
21+
unsigned int i, j;
22+
//Time X 1ms
23+
for(i=0;i<time;i++)
24+
{
25+
for(j=0;j<113;j++);
26+
}
27+
}

Relay_Interface/circuit.png

97.2 KB
Loading

0 commit comments

Comments
 (0)