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.

need code that can measure the duty cycle as frequency varies using atmega8

Status
Not open for further replies.

likitha.b

Newbie level 5
Joined
Mar 4, 2013
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,370
hi,

we will be giving a frequency of range 100hz-1Mhz from the signal generator to the interrupt pin of atmega8 microcontroller , we need measure the frequecny and inturn the duty cycle as the output form any other pin of the controller , and the o/p dutycycle should be given to the cro.
 

If frequency of input pulse changes, duty cycle also changes. can't you calculate duty cycle from frequency? What do you mean by giving o/p duty cycle to CRO. Do you generate pulse for changing duty cycle and give it to CRO?
 

If frequency of input pulse changes, duty cycle also changes. can't you calculate duty cycle from frequency? What do you mean by giving o/p duty cycle to CRO. Do you generate pulse for changing duty cycle and give it to CRO?

we need to need to display the duty cycle on the cro. we need to to write the the code using interrupt and timer.
 

CRO = Oscilloscope.

Measure the pulse width of the transmitted signal. If you do not know it, connect the output of the signal to the input of an oscilloscope. The oscilloscope screen will show a series of pulses oscillating at the frequency of the signal. Note the width, in seconds or microseconds, of each pulse. This is the pulse width, or PW, of the signal.

2
Calculate the period, or "T", of the frequency, or "f," using the formula: T = 1/f. For example, if the frequency is 20 hz, then T = 1/20, with a result of 0.05 seconds.

3
Determine the duty cycle, represented by "D," through the formula D = PW/T. As an example, if PW is 0.02 seconds and T is 0.05 seconds, then D = 0.02/0.05 = 0.4, or 40%.

Check this link http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=1014053
 
Last edited:

Duty cycles can be measured with input capture unit by determing both low and high period, but only within the timing resolution given by the processor clock. Duty cycle infomation at 1 MHz will be respectivly coarse.

Outputs of ATmega are exclusively digital (0/1), so I wonder how you want to output the duty cycle by a single pin?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top