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.

[51] Generate a square wave with duty-cicle of 70% on 8051 (assembly)

Status
Not open for further replies.

Junio Avelinor

Newbie level 1
Newbie level 1
Joined
Mar 15, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
10
1)Hi. Good Morning, I'm having many doubts to generate a SQUARE wave with DUTY-CYCLE of N% on 8051.
1.1)I don't know but, to generate 50% is easy, but 66% or 78% is not.

2)The problems are in CALCULUS and The CODE in ASSEMBLY.
3)Some codes uses Interrupt, others not.


4) I also like to create a control like below, BUT I do not understand the principles.

duty cycle = Ton / Ton + Toff

duty cycle = 1s / 1s + 3s = 1s / 4s = 0.25



5) Are These informations enough to program the code ?

//ASSUME DUTY CYCLE 70%
//Crystal 12MHZ CLOCK.
//USE TIMERS
//CHECK OUT PUT IN P3.2




6) PLEASE COMMENT THE CODE

7) THANKS FOR YOUR HELP, GOD BLESS YOU
 

hello,

before to adjust the duty ratio, you must define the Frequency of the square wave
Periode= 1/F
so you know Periode T = 100% of Duty
you define the time for 1% ( we can suppose that 1% of resolution is enough)
and apply the "regle de 3 " for every duty value do you want
use a timer to count elementary time for 1%

SQ freq=1Khz T=1mS =1000µs
adjust timer0 for 10µs interrupt
for Duty=68% ,
output =1 during 68 interrupts ..
after Output=0 during (100-68) interrupts

or use simple delay loops

or better solution : use PWM !
define the Frequency
adjust the Duty
 

70% AND SQUARE WAVE is an OXYMORON.
Anything not 50% is a rectangular pulse .

using positive logic 0% is low 100% is high.

the timer length reduces output frequency by n which is the total counts for Ton + Toff.
Choose any value of n such as 1024.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top