johnny01hk
Junior Member level 1
I want to add the INT0 into my program,
When the INT have Logic 0 input,then the progarm will auto jump to Z,
also stop before working process.
But I don't know how to add that function on my progarm.
And I don't know hot to setting the other point.
For example the IT0, EA, EX0,
Who can help me write a command and setting into my progarm?
--------------------------------------------
ORG 00H
JMP START
ORG 100h
START:
SETB P2.0 ;Motion detector Input
SETB P2.1 ;Metal detector Input
CLR P1.0
CLR P1.1
Loop:
JNB P2.0, X
JNB P2.1, Z
SJMP Loop
; = = = = = = = = = = = = = =
X:
SETB P1.0
CLR P1.1
LCALL Delay ;Call Delay
CLR P1.0
CLR P1.1
SJMP START
Z:
SETB P1.1
CLR P1.0
LCALL Delay ;Call Delay
CLR P1.0
CLR P1.1
SJMP START
; = = = = = = = = = = = = = =
Delay:
MOV R2, #50 ;~1s
S1:
MOV R3, #200
S2:
MOV R4, #200
DJNZ R4, $
DJNZ R3, S2
DJNZ R2, S1
RET
END
When the INT have Logic 0 input,then the progarm will auto jump to Z,
also stop before working process.
But I don't know how to add that function on my progarm.
And I don't know hot to setting the other point.
For example the IT0, EA, EX0,
Who can help me write a command and setting into my progarm?
--------------------------------------------
ORG 00H
JMP START
ORG 100h
START:
SETB P2.0 ;Motion detector Input
SETB P2.1 ;Metal detector Input
CLR P1.0
CLR P1.1
Loop:
JNB P2.0, X
JNB P2.1, Z
SJMP Loop
; = = = = = = = = = = = = = =
X:
SETB P1.0
CLR P1.1
LCALL Delay ;Call Delay
CLR P1.0
CLR P1.1
SJMP START
Z:
SETB P1.1
CLR P1.0
LCALL Delay ;Call Delay
CLR P1.0
CLR P1.1
SJMP START
; = = = = = = = = = = = = = =
Delay:
MOV R2, #50 ;~1s
S1:
MOV R3, #200
S2:
MOV R4, #200
DJNZ R4, $
DJNZ R3, S2
DJNZ R2, S1
RET
END