hi guys...i'm new to 8051....
and in the process of learning assembly language now
i wrote the below code ...a subroutine to cause the microcontroller delay for 1second...
and i tried to run it on the simulator...and found that the code keep looping on the instrution WAIT: JNB TF0,WAIT after MOV P1,#10001000B
it just wont continue to the next instructions...what's wrong with the code?
by the way...i'm working on ATMEL 89c51 with 12Mhz crystal
any 1 can help me out?...
HUNDRED EQU 100
COUNT EQU -10000
ORG 00H
MOV TMOD,#01H
MOV P1,#10001000B
CALL DELAY
MOV P1,#01010101B
CALL DELAY
MOV P2,#10101010B
DELAY:
MOV R7,#HUNDRED
AGAIN:
MOV TH0,#HIGH COUNT
MOV TL0,#LOW COUNT
SETB TR0
WAIT: JNB TF0,WAIT
CLR TF0
CLR TR0
DJNZ R7,AGAIN
RET
END
and in the process of learning assembly language now
i wrote the below code ...a subroutine to cause the microcontroller delay for 1second...
and i tried to run it on the simulator...and found that the code keep looping on the instrution WAIT: JNB TF0,WAIT after MOV P1,#10001000B
it just wont continue to the next instructions...what's wrong with the code?
by the way...i'm working on ATMEL 89c51 with 12Mhz crystal
any 1 can help me out?...
HUNDRED EQU 100
COUNT EQU -10000
ORG 00H
MOV TMOD,#01H
MOV P1,#10001000B
CALL DELAY
MOV P1,#01010101B
CALL DELAY
MOV P2,#10101010B
DELAY:
MOV R7,#HUNDRED
AGAIN:
MOV TH0,#HIGH COUNT
MOV TL0,#LOW COUNT
SETB TR0
WAIT: JNB TF0,WAIT
CLR TF0
CLR TR0
DJNZ R7,AGAIN
RET
END