almoatazbellah
Newbie level 4
hi all,
i'm new in programming 89c51 and i just wrote a program for free running pulse generator with 1KHZ and 10% duty cycle, can u guys take a look on it and tell me if it is ok or there something wrong.
note: the Freq.osc.=12MHZ and machine cycle = 1 us
include 89c51.mc
org 0
MOV P0,#0
MOV TMOD,#01H ; timer 0 mode 1
AGAIN:
SETB P0.0
CLR P0.0
CALL DELAY
JMP AGAIN
DELAY:
MOV TH0,#FCH
MOV TL0,#17H
SETB TR0
WAIT:
JNB TF0,WAIT
CLR TR0
CLR TF0
RET
i'm new in programming 89c51 and i just wrote a program for free running pulse generator with 1KHZ and 10% duty cycle, can u guys take a look on it and tell me if it is ok or there something wrong.
note: the Freq.osc.=12MHZ and machine cycle = 1 us
include 89c51.mc
org 0
MOV P0,#0
MOV TMOD,#01H ; timer 0 mode 1
AGAIN:
SETB P0.0
CLR P0.0
CALL DELAY
JMP AGAIN
DELAY:
MOV TH0,#FCH
MOV TL0,#17H
SETB TR0
WAIT:
JNB TF0,WAIT
CLR TR0
CLR TF0
RET