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.

Finding time period of an unknown signal

Status
Not open for further replies.

BojackHorseman

Newbie level 6
Newbie level 6
Joined
Oct 7, 2022
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
91
I want to find the time period of an unknown signal in microseconds. I already have a code that helps me find the frequency of an unknown signal. Is there a way to modify that code to find the time period of that signal in microseconds ?
Code:
`timescale 1ns / 1ps

module freq_counter( input clk_100mhz,
input reset,
input low_freq_clk,
output reg [13:0] out1
    );

reg low_freq_clk_x, low_freq_clk_xx, low_freq_clk_xxx;
reg [25:0] lo_counter;
reg [26:0] hi_counter;
always @(posedge clk_100mhz or posedge reset) begin
  if (reset) begin
  lo_counter <= 26'd0;
  hi_counter <= 27'd0;
  out1 <= 14'd0;
  end
 
else begin 
 
  low_freq_clk_xxx <= low_freq_clk_xx;
  low_freq_clk_xx <= low_freq_clk_x;
  low_freq_clk_x <= low_freq_clk;


  if (low_freq_clk_xxx & ~low_freq_clk_xx) lo_counter <= lo_counter + 1'b1;

  // Output total frequency when one second is up
  if (hi_counter == 27'd100000000) begin
    out1 <= lo_counter;
    lo_counter <= 1'b0;
    hi_counter <= 1'b0;
  end else
    hi_counter <= hi_counter + 1'b1; // Elapse time
end
end
endmodule
 

Hi,

Basically if you have the frequency, then just do

t(p_us) = 1,000,000/f

****

But an unknown signal ... it can be anything...

****

At least you should specify
* the frequency range,
* the resolution,
* the update rate.

Klaus
 

Hi,

Basically if you have the frequency, then just do

t(p_us) = 1,000,000/f

****

But an unknown signal ... it can be anything...

****

At least you should specify
* the frequency range,
* the resolution,
* the update rate.

Klaus
The frequency range is from 1000Hz to 9999 Hz. As for resolution I want the output in microseconds and update every 1 second.
 

Hi,

and what about the "unknown" signal? How "unknown" is it?
In best case it is a clean square wave logic signal. Then the signal is not a at all unknow, just it´s frequency.
Or ist it any analog signal, or any modulated signal?

Klaus
 

@BojackHorseman
One cannot design a digital system where NOTHING is known about the system input/s.
The more information you give us, the more help will you get!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top