Skip to content

Commit d8d7d7e

Browse files
authored
Add files via upload
1 parent 277a6f5 commit d8d7d7e

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

Interrupt/ckt.png

110 KB
Loading

Interrupt/level_triggered.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Code for Interrupt using Level Triggered Mode
2+
// We are witting a code for square wave generator such that when an interrupt occurs the state of LED changes
3+
4+
#include<reg51.h>
5+
6+
void MSDelay(unsigned int);
7+
8+
sbit sq_wave=P1^3;
9+
sbit LED=P1^4;
10+
sbit SW=P3^2;
11+
12+
void EINT_LED() interrupt 0
13+
{
14+
LED=~LED; //cpl
15+
MSDelay(500);
16+
}
17+
18+
void MSDelay(unsigned int time)
19+
{
20+
unsigned int i,j;
21+
for (i=0;i<time;i++)
22+
for (j=0;j<113;j++);
23+
}
24+
25+
void main()
26+
{
27+
SW=1; // p3.2 input
28+
LED=0;
29+
IT0=0; //LEVEL TRIGGERED
30+
IE=0x81; //enable interrupt for EINT0 EXTERNAL INTERRUPT 0
31+
while (1)
32+
{
33+
sq_wave=1;
34+
MSDelay(500);
35+
sq_wave=0;
36+
MSDelay(500);
37+
}
38+
}
39+

Interrupt/output.png

577 KB
Loading

0 commit comments

Comments
 (0)