We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dbce596 commit 40806c7Copy full SHA for 40806c7
Timer_interface/output.png
54 KB
Timer_interface/timer.asm
@@ -0,0 +1,26 @@
1
+ORG 00H
2
+
3
+MOV TMOD, #01H // mode 1 (16 bit timer moder) ,timer 0
4
+again1: // while loop
5
+// led blink code
6
+MOV P1, #0FFH // logic 1
7
+ACALL DELAY
8
+MOV P1, #00H // logic 0
9
10
+SJMP again1 // short jump
11
12
+// delay of 5ms 00H (0) TO 0EEH
13
+// 1 count = 1.085us
14
+// 4608 counts = 5ms
15
+// max counts = 65536 (2^16)
16
+// so 65536 - 4608 = 60928 counts =EE00 (in hex)
17
18
+DELAY: MOV TL0, #00H
19
+MOV TH0, #0EEH
20
+SETB TR0 // to turn ON the timer(timer 0 control run bit)
21
+again: JNB TF0 ,again // flag bit when there is roll over from fffh to 000h(overflow flag)
22
+CLR TR0 // JNB - jump if bit is not set
23
+CLR TF0
24
+RET
25
26
+END
0 commit comments