Frequency and time confusion

electronicsLearner77

Jul 2, 2015
306
Joined
Jul 2, 2015
Messages
306
Whenever i am dealing with frequency of signals in micro controllers. I am always getting confused with calculations. Should i proceed thinking of the signals completely in terms of frequency or completely in terms of time duration. I get terribly confused. How should i handle? Any suggestions? Sorry for not relavant question.
 

AnalogKid

Jun 10, 2015
3,055
Joined
Jun 10, 2015
Messages
3,055
The time of a periodic signal is called its period. That is the elapsed time of one complete cycle of the signal. It is the inverse of the frequency. a 10 Hz signal has a period of 0.1 (1/10) second. All repeating signals have a frequency, and hence a period. You use whichever one is appropriate to what you are doing. It rarely is appropriate to think of a signal "completely in terms of frequency or completely in terms of time duration."

For example, a task might be to use a uC to measure the frequency of a signal. A uC cannot measure frequency, but it can measure time either by internally counting in a software loop the number of passes through a loop, using an internal counter peripheral to count cycles of the uC clock, etc. You then use software to invert the result, place the decimal point correctly, and format the result for whatever the display is. So you think in terms of period for the measurement, and in terms of frequency for the result. tow sides of the same thing.

ak
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Actually, AK's example is the perfect example of why you must think both in terms of time and frequency. Suppose you need to measure a frequency.

Let's say it is in the region of 1 MHz. Your micro will not be fast enough to measure the time between consecutive cycles. The way you do this is to send the 1 MHz signal directly to a counter on the micro. You then run a timer to set and interval of, say 10 ms. At the end of the interval, you take the count from time timer and calculate the frequency, for example. 10000 counts is exactly 1MHz. This is measuring frequency.

Now suppose the signal is 1 Hz. In order to measure this the way same way as you did 1 MHz, you would have to make the interval 100 seconds to get 1% accuracy. This is most likely way too long to wait. Instead, you measure the time by starting a timer at the leading edge, and stopping it at the next leading edge. Now the counts in the timer gives you the period, and you invert it to get the frequency.

Bob
 
Last edited:

OBW0549

Jul 5, 2016
157
Joined
Jul 5, 2016
Messages
157
Whenever i am dealing with frequency of signals in micro controllers. I am always getting confused with calculations. Should i proceed thinking of the signals completely in terms of frequency or completely in terms of time duration.
Neither. You simply will have to become adept at both. There is no way around it.

I get terribly confused. How should i handle?
Practice, practice, and more practice.
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
Let me add,

All Signals may be represented in the time domain or frequency domain.
They are like two sides of the same coin.
The ability to "view" them in each domain is "handy",
you should pick the one that is the simplest to handle/most useful/best to gain insight etc.

Note that most signals are not periodic as described above,and still both time and frequency apply to them.
It is sometimes referred to as time-frequency analysis/spectral content vs. time.
In general, the Fourier content of a time signal and vice versa .

Here is a complex periodic signal in time and frequency:

sigadd3freqcomp.gif

Note :
although the signal is periodic,and you could talk about it's frequency to be f0=1/T,
infect, this is only part of the all picture:it relates only to the fundamental frequency of which this signal is "composed".
In the frequency domain we simply have 3 sines combined.



Here is a non-periodic signal and it's "frequency content".

1af4325370.gif

Note:
How simple this pulse(time duration of tau) looks in the time domain and how complex it's content is in the frequency domain.
 

Terry01

Jul 5, 2017
206
Joined
Jul 5, 2017
Messages
206
Thank god it'll be a long long time before I need to worry about learning this kind of stuff.....if ever! How you manage to know this of the top of your heads is beyond me. That's maybe a good indicator I should just keep reading and being in awe of these posts???

Hmmmm.....
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,986
Joined
Jun 21, 2012
Messages
4,986
Interesting thread. I remember that "ah ha!" moment near the middle of the previous century when I realized that looking at things in the "time domain" versus looking at the same things in the "frequency domain" was still (always) looking at the same things... just a different perspective is all.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
14,309
Joined
Nov 17, 2011
Messages
14,309
just a different perspective is all.
Plus this different perspective may help solve problems which seem intractable in one domain quite easily in another domain.
@dorke in post #5 gave an excellent example.

Here's one the other way round:
It is almost impossible to separate an audio signal (20 Hz ... 20 kHz) into frequency ranges (low, mid, high) by looking at the time domain signal.
Looking at the same signal in the frequency domain this separation becomes a piece of cake.
 
Top