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.

Generåte 2 wåves of dífferent duty cycle on 2 dífferent píns by usíng both tímer 8051

Status
Not open for further replies.

Eshal

Advanced Member level 1
Advanced Member level 1
Joined
Aug 29, 2012
Messages
470
Helped
16
Reputation
32
Reaction score
15
Trophy points
1,298
Location
Nowhere :)
Visit site
Activity points
5,149
Hello to all experts!

I want to generate two different waves on two different port pins of different duty cycle in 8051 using assembly language.

one wave is of 10 KHz of 50% duty cycle on pin p1.0
other wave is of 1 KHz of 10% duty cycle on pin p0.0

Here is the code what I get until now.

Code:
	org 0
		mov tmod, #12h          ;timer1 in mode=1 and timer0 in mode-2
		mov th0, #-50             ;reload value for timer0
		setb tr0                      ;start timer0
loop:         mov th1, #0feh
		mov tl1, #0ch
		setb tr1
wait:         jnb tf0, next                ;check if timer0 is overflowed
		clr tf0                         ;clear flag bit of timer0 is overflowed
		cpl p1.0
next:	        jnb tf1, wait                 ;chekc if timer1 is overflowed
		clr tr1                          ;stop timer1
		clr tf1                          ;clear flag bit of timer1 is overflowed
		cpl p0.0
		sjmp loop
		end

What changes should I make in order to satisfy above requirements? The above code shown is generating two different wave of 10KHz and 1KHz but both are 50% duty cycle. I want 10KHz as 50% and 1KHz as 10%.

Thank you very much

Princess
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top