Skip to content

Commit dbce596

Browse files
authored
Add files via upload
1 parent 86ef7d4 commit dbce596

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Timer_interface/ckt.png

51.7 KB
Loading

Timer_interface/timer.c

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include<reg52.h>
2+
3+
void ms_delay();
4+
5+
void main()
6+
{
7+
8+
TMOD = 0X01; // timer 0 , mode 1,16 bit mode
9+
while(1)
10+
{
11+
P1 = 0XFF; // sending high and low logic
12+
ms_delay();
13+
P1 =0X00;
14+
ms_delay();
15+
}
16+
}
17+
18+
void ms_delay() // 5ms
19+
{
20+
TL0=0X00; // timer 0 low
21+
TH0=0X0EE; //timer 0 high (5ms)
22+
TR0=1; // turn ON timer 0
23+
24+
while(!TF0); // if overflow flag is high
25+
TR0=0; // turn timer off
26+
TF0=0; // clear the timer flag reg.
27+
}
28+

0 commit comments

Comments
 (0)