Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pulse generator using 89c51

Status
Not open for further replies.

almoatazbellah

Newbie level 4
Joined
Dec 3, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,316
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
 

Your Delay calculation for 1000us is correct.

Your output will be like this: On time=1us and Off time=1000us.

10% duty cycle at 1KHz should be: On time = 100us and Off time=900us.

change the code according to the above timings
 

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
which controller u r using? specify the full name of the controller
in some controllers trherre are PWM inbult so that make easy to code
 

you can also use PWM module which is inbuilt inside of that controller . read the data sheet of 8051 PCA topc
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top