ORG 00H
LJMP MAIN
ORG 1BH ;COUNTER 1
JB TF1,REACH
RETI
REACH: CLR TF1
CLR TR1
SETB P0.1
RETI
ORG 30H
MAIN: MOV P0,00H
MOV P2,00H
MOV P3,0FFH ;INPUT
MOV P1,#0ffH; input
MOV IE,#10001000B ; 1000 1000
MOV TMOD,#60H ;COUNTER1 MODE 2 0110 0000
MOV TL0,#0FAH ;1111 1000
MOV TH0,#0FAH
MOV IP,#00001000B
SETB P0.5
SETB TR1 ;START COUNTING
AGAIN: CPL P1.3
LJMP AGAIN
END
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
All i need to do here is to make an ir sensor program which counts how many times it is cut ,but with limits so i make it 8 counts here, but there is other things so i cant keep watching the pin for it, So i thought about making it connected to T1 (P3.5) and works as a counter. but what i cant find the problem in this code :S any help
LJMP MAIN
ORG 1BH ;COUNTER 1
JB TF1,REACH
RETI
REACH: CLR TF1
CLR TR1
SETB P0.1
RETI
ORG 30H
MAIN: MOV P0,00H
MOV P2,00H
MOV P3,0FFH ;INPUT
MOV P1,#0ffH; input
MOV IE,#10001000B ; 1000 1000
MOV TMOD,#60H ;COUNTER1 MODE 2 0110 0000
MOV TL0,#0FAH ;1111 1000
MOV TH0,#0FAH
MOV IP,#00001000B
SETB P0.5
SETB TR1 ;START COUNTING
AGAIN: CPL P1.3
LJMP AGAIN
END
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
All i need to do here is to make an ir sensor program which counts how many times it is cut ,but with limits so i make it 8 counts here, but there is other things so i cant keep watching the pin for it, So i thought about making it connected to T1 (P3.5) and works as a counter. but what i cant find the problem in this code :S any help
Last edited: