johnny01hk
Junior Member level 1
I was done a program.
The concept as below:
I will have two input into the IC (P2.0 and P2.1),
The input will be a digital signal.
When P2.0 Input signal is 1.
Then Will have output, It may be P1.1,
And it will output 5second times 5V signal to the motor.
In other ways, The P2.1 will be the same,
But the output is P1.2 .
But It is not work.
And I want 5second delay of the process.
So that what is my program problem and how to correct it?
-----------------------------------------
ORG 00H
JMP START
ORG 100h
START: SETB P2.0 ;Motion detector Input
SETB P2.1 ;Metal detector Input
JB P2.0, $ ;If Motion detector Input 1
JMP X ;Go to X
JB P2.1, $ ;If Metal detector Input 1
JMP Z ;Go to Z
Z: SETB P1.2
CLR P1.3
MOV R4,#2 ; set delay for 60s ..
MOV R3,#166
MOV R2,#223
MOV R1,#117
RET
X: SETB P1.3
MOV R4,#2 ; set delay for 60s ..
MOV R3,#166
MOV R2,#223
MOV R1,#117
RET
END
--------------------------------------------------
A51 MACRO ASSEMBLER V1.13
COPYRIGHT MANLEY ELECTRONICS CO., LTD. 2001-2006
ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)
The concept as below:
I will have two input into the IC (P2.0 and P2.1),
The input will be a digital signal.
When P2.0 Input signal is 1.
Then Will have output, It may be P1.1,
And it will output 5second times 5V signal to the motor.
In other ways, The P2.1 will be the same,
But the output is P1.2 .
But It is not work.
And I want 5second delay of the process.
So that what is my program problem and how to correct it?
-----------------------------------------
ORG 00H
JMP START
ORG 100h
START: SETB P2.0 ;Motion detector Input
SETB P2.1 ;Metal detector Input
JB P2.0, $ ;If Motion detector Input 1
JMP X ;Go to X
JB P2.1, $ ;If Metal detector Input 1
JMP Z ;Go to Z
Z: SETB P1.2
CLR P1.3
MOV R4,#2 ; set delay for 60s ..
MOV R3,#166
MOV R2,#223
MOV R1,#117
RET
X: SETB P1.3
MOV R4,#2 ; set delay for 60s ..
MOV R3,#166
MOV R2,#223
MOV R1,#117
RET
END
--------------------------------------------------
A51 MACRO ASSEMBLER V1.13
COPYRIGHT MANLEY ELECTRONICS CO., LTD. 2001-2006
ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)