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.

[SOLVED] How a high frequency (50 MHz) is measured using a PIC with 4MHz clock?

Status
Not open for further replies.

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
751
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,054
How a high frequency ,say 50 MHz is measured using a PIC16 with 4MHz clock? What actually is the method used in this case?
Because I could assume it if it is a low frequency of few KHz..In such case, I hope it could be done by timer increment on external clock....
But the 50 MHz is confusing me...Pls check the link below:
Frequency Meter / Frequency Counter 10Hz-60MHz
 

It uses the timer0 clock input, the timer is set to count with the clock pulses from the external source (the measured signal) with the prescaler enabled so that it can be used with a frequency higher than the internal clock.
It probably uses a second timer as gate for the time that the signal is measured and then it calculates the frequency.

The datasheet says

Counter mode is selected by setting the T0CS bit. In
this mode the TMR0 register value will increment either
on every rising or falling edge of pin RA4/T0CKI/CMP2.
The incrementing edge is determined by the source
edge (T0SE) control bit (OPTION<4>). Clearing the
T0SE bit selects the rising edge. Restrictions on the
external clock input are discussed in detail in
Section6.2 “Using Timer0 with External Clock”.

When a prescaler is used, the external clock input is
divided by the asynchronous ripple-counter type
prescaler so that the prescaler output is symmetrical.
For the external clock to meet the sampling
requirement, the ripple-counter must be taken into
account. Therefore, it is necessary for T0CKI to have a
period of at least 4TOSC (and a small RC delay of 40ns)
divided by the prescaler value. The only requirement
on T0CKI high and low time is that they do not violate
the minimum pulse width requirement of 10ns.

Alex
 
4MHz is the system clock but the TMR0 counter can actually work much faster and can often accept 50MHz or more.
To measure the frequency you have to reset the timer, wait for a specific time then read the counter value. For example if you reset it, generated a one second delay in software then read the counter back it would tell you the number of cycles per second (Hz). To measure higher frequencies you obviously need shorter times so fewer cycles are captured but the 'gate' or 'window' time can still be generated using a lower clock speed.

Brian.
 
Last edited:
Vinodstanur,

You might find this project discussion informative. It is basically the same design as the link you provided except it utilizes seven segment displays instead of the LCD. It discusses in depth the technique both Alex and Brian pointed out and provides both Assembly Source and Schematics. Of course, the design could easily be adapted to use an LCD instead of the seven segment displays.

Frequency counter with a PIC and minimum hardware

BigDog
 
Thanks for the above link and thats really informative
 
Last edited:

M e I am not gettinn well how counting high frequencies,I designed one it gives good period for lower freqeucnies(f<1Mhz),but above this it is giving wrong period ;can you plz help me with ccs c to count the period for a signal of 1.2Mhz as exaample.

Thanks,I am using pic16f877a and the module CCP1 for detecting those lower frequencies.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top