We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 277a6f5 commit d8d7d7eCopy full SHA for d8d7d7e
Interrupt/ckt.png
110 KB
Interrupt/level_triggered.c
@@ -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
35
+sq_wave=0;
36
37
38
39
Interrupt/output.png
577 KB
0 commit comments