Frequency counter 35 Mhz
Moderator: Benj
Frequency counter 35 Mhz
Hi, all
Have a look at this file:
http://www.google.com.pk/url?sa=t&rct=j ... 1g&cad=rja
It describe technique to measure frequency from 10 Hz to 35 MHz by using 16f84a chip. (though seems to be not possible), but it is.
My question is how to implement this technique to flowcode. It is for all senior and experts using flowcode. If someone already did, plz upload fcf file for other to review and knowledge.
Thanks
wasee
Have a look at this file:
http://www.google.com.pk/url?sa=t&rct=j ... 1g&cad=rja
It describe technique to measure frequency from 10 Hz to 35 MHz by using 16f84a chip. (though seems to be not possible), but it is.
My question is how to implement this technique to flowcode. It is for all senior and experts using flowcode. If someone already did, plz upload fcf file for other to review and knowledge.
Thanks
wasee
Re: Frequency counter 35 Mhz
Hi
if you look at page 2 and 3 of the pdf you linked to it gives the program steps and timing diagram, look at page 3 there is a also flowchart listing the steps taken by the program, you need to replicate this in flowcode , have a go at it and then post your flowchart as that way people will be able to help more or advise other ways of doing it hth
Regards
Dazz
if you look at page 2 and 3 of the pdf you linked to it gives the program steps and timing diagram, look at page 3 there is a also flowchart listing the steps taken by the program, you need to replicate this in flowcode , have a go at it and then post your flowchart as that way people will be able to help more or advise other ways of doing it hth
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
Re: Frequency counter 35 Mhz
Sir, You are right. I am hobbyist. New to programming due to flowcode. I am looking same flowchart for days, but could not figure out how to impliment it on flowcode. That was why I posted on forum if some experts can do the job. I hope this project will be a valuable assest not only to our lab, but the whole community willing to have F meter like so.
Re: Frequency counter 35 Mhz
Plz look at :
http://www.hamradio.in/circuits/freq_counter_lcd.php
I downloaded hex file and run it on Proteus simulator. It really worked for 30 MHZ. It is working example.
It would be great if someone can make fcf file from it.
http://www.hamradio.in/circuits/freq_counter_lcd.php
I downloaded hex file and run it on Proteus simulator. It really worked for 30 MHZ. It is working example.
It would be great if someone can make fcf file from it.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Frequency counter 35 Mhz
Basically how the frequency counter works is:
Prescaller of timer 0 interrupt is set to 1:256
In effect although timer 0 is a 8 bit its acting like a 16bit counter.
Since T0cki pin is used, each time T0ck goes from low to high (or high to low depending on source edge selection setting) then prescaller register counts up 1 (equivalent to Low byte of a 16bit timer)
When prescaller rolls over from 255 to 0 (256 changes of T0CKI) then timer 0 register is incremented by 1 (equivalent of high byte of 16bit counter).
This is the same as feeding a frequency into a divide by 256 counter.
So in effect what happens is T0CKI is gated (an output from a different pin is also connected to T0CKI is repeating forcing it low after a set period of time).
So there must be a resistor connected in series with frequency being measured and T0CKI pin.
Gating is automatically adjusted (gating time increased) if timer0 rolls over before gating time has elapsed.
Then frequency is calculated since set time period of gating is known and from reading timer0.
Frequency is displayed on LCD or LED (since T0CKI is in effect not now running it won’t be interfering). Decimal point is in a position determined by which gating time is used
This is how the higher frequencies can be read and displayed.
I would say Something like this is fairly easily achievable with Flowcode.
If I can find so spare time I will create a high frequency counter using the above method.
Martin
Prescaller of timer 0 interrupt is set to 1:256
In effect although timer 0 is a 8 bit its acting like a 16bit counter.
Since T0cki pin is used, each time T0ck goes from low to high (or high to low depending on source edge selection setting) then prescaller register counts up 1 (equivalent to Low byte of a 16bit timer)
When prescaller rolls over from 255 to 0 (256 changes of T0CKI) then timer 0 register is incremented by 1 (equivalent of high byte of 16bit counter).
This is the same as feeding a frequency into a divide by 256 counter.
So in effect what happens is T0CKI is gated (an output from a different pin is also connected to T0CKI is repeating forcing it low after a set period of time).
So there must be a resistor connected in series with frequency being measured and T0CKI pin.
Gating is automatically adjusted (gating time increased) if timer0 rolls over before gating time has elapsed.
Then frequency is calculated since set time period of gating is known and from reading timer0.
Frequency is displayed on LCD or LED (since T0CKI is in effect not now running it won’t be interfering). Decimal point is in a position determined by which gating time is used
This is how the higher frequencies can be read and displayed.
I would say Something like this is fairly easily achievable with Flowcode.
If I can find so spare time I will create a high frequency counter using the above method.
Martin
Martin
-
- Posts: 45
- Joined: Mon Nov 07, 2011 6:36 pm
- Has thanked: 1 time
- Been thanked: 30 times
Re: Frequency counter 35 Mhz
Hi all
The method used here is described in an old Microchip application note, written in the late 90s which I remember reading
.
http://www.microchip.com/stellent/idcpl ... e=en011033
The reason that RA3 is connected to T0CKI is to gate the input signal and also used to get the value of the prescaler, some how (didnt really read it that indepth).
I think the best bet is to use a PIC with a 16bit counter
http://www.matrixmultimedia.com/mmforum ... 46&t=10800
This could be modified so that on an overflow of the counter a byte variable is incremented, combining both the counter and the variable will give you a 24bit frequency counter.
Gary
This site is using the same method, and is very similar in design ???
http://www.qsl.net/om3cph/om3cph.html
The method used here is described in an old Microchip application note, written in the late 90s which I remember reading

http://www.microchip.com/stellent/idcpl ... e=en011033
The reason that RA3 is connected to T0CKI is to gate the input signal and also used to get the value of the prescaler, some how (didnt really read it that indepth).
I think the best bet is to use a PIC with a 16bit counter
http://www.matrixmultimedia.com/mmforum ... 46&t=10800
This could be modified so that on an overflow of the counter a byte variable is incremented, combining both the counter and the variable will give you a 24bit frequency counter.
Gary
This site is using the same method, and is very similar in design ???
http://www.qsl.net/om3cph/om3cph.html
Re: Frequency counter 35 Mhz
Great to know that senior members took interest in this project. I would request you to plz lets start to make a project in flowcode V4. I got the sense of medelac's detail, but I am newbie in this field hence problem with creating fcf in this manner.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Frequency counter 35 Mhz
Thanks Gary. This removes one of my miss conception.The method used here is described in an old Microchip application note, written in the late 90s which I remember reading.
http://www.microchip.com/stellent/idcpl ... e=en011033
The reason that RA3 is connected to T0CKI is to gate the input signal and also used to get the value of the prescaler, some how (didnt really read it that indepth)
Enamul
Re: Frequency counter 35 Mhz
Enamul:
I actually linked site so that one can know the technique of making F meter. Second, indian site is the practical example. I thought that flowchart would be easy to understand as compared to asm file on indian site. Anyhow, your knowledge and contribution would be greatly appreciated. Plz contribute your valuable experience to community.
I actually linked site so that one can know the technique of making F meter. Second, indian site is the practical example. I thought that flowchart would be easy to understand as compared to asm file on indian site. Anyhow, your knowledge and contribution would be greatly appreciated. Plz contribute your valuable experience to community.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Frequency counter 35 Mhz
This is my first attempt, and it probably wont work to well either.
I have attempted to create an auto range digital frequency counter, but unable to test on hardware so I don't know what frequency will work up to, or how accurate it is (or if it works at all!).
If some one who has access to a frequency generator, would you mind tying this out please.
If it does not work well, you may be able to spot flaws in my theory.
Input is via T1CKI.
For 16f877A is RC0
Flowchart is still using gating, but is software gated rather than hardware which is used in the frequency counters previously mentioned.
I will see if I can set something up tomorrow to generate a frequency, and test counter
When I can get counter to work. I will add notes on the flowchart on how it all works.
Martin
I have attempted to create an auto range digital frequency counter, but unable to test on hardware so I don't know what frequency will work up to, or how accurate it is (or if it works at all!).
If some one who has access to a frequency generator, would you mind tying this out please.
If it does not work well, you may be able to spot flaws in my theory.
Input is via T1CKI.
For 16f877A is RC0
Flowchart is still using gating, but is software gated rather than hardware which is used in the frequency counters previously mentioned.
I will see if I can set something up tomorrow to generate a frequency, and test counter
When I can get counter to work. I will add notes on the flowchart on how it all works.
Martin
- Attachments
-
- High Frequency Counter 16F877A FC5.fcf
- LCD version
- (19.51 KiB) Downloaded 548 times
Martin
Re: Frequency counter 35 Mhz
Hi, medelac, I made proteus file and loaded Hex file from your fcf file. Nothing happening.
- Attachments
-
- High Frequency Counter 16F877A FC5.rar
- (13.29 KiB) Downloaded 461 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Frequency counter 35 Mhz
Hi mtqc76,
I have been able to test up to 1MHz, and all appears ok.
Display is showing correct frequency from 1 KHz to 1MHz
unfortunately I'm struggling to get a signal to go above 1MHz
Have you checked configuration and connections of LCD in Proteus?
Thanks for testing anyway.
I have been able to test up to 1MHz, and all appears ok.
Display is showing correct frequency from 1 KHz to 1MHz
unfortunately I'm struggling to get a signal to go above 1MHz
Have you checked configuration and connections of LCD in Proteus?
Thanks for testing anyway.
Martin
Re: Frequency counter 35 Mhz
Thanks Medelec.
Got it working, nothing wrong with connection. When I changed different frequency input, it did work in proteus, but below 100 hz was not showing anything, similar if i input 100K was showing 10 k hz, lower frequencies were fine. Anyhow, very very good effort to start with flowcode. My teacher in school is also working on it to make a flowchart and do some work on it, lets see if he give any input in this project.
Got it working, nothing wrong with connection. When I changed different frequency input, it did work in proteus, but below 100 hz was not showing anything, similar if i input 100K was showing 10 k hz, lower frequencies were fine. Anyhow, very very good effort to start with flowcode. My teacher in school is also working on it to make a flowchart and do some work on it, lets see if he give any input in this project.
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
Re: Frequency counter 35 Mhz
I'll try and get time test it tomorrow with my xtal standard.
That can generate the following frequencies 2.5k 10K 25k 100k 250k 1M 2.5M 10M
Max level is about 0.8V so should be ok for this.
That can generate the following frequencies 2.5k 10K 25k 100k 250k 1M 2.5M 10M
Max level is about 0.8V so should be ok for this.
1 in 10 people understand binary, the other one doesn't !
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Frequency counter 35 Mhz
Thanks guys for taking an intrest
.
What I did not make clear (sorry mtqc76) is:
I designed with a minimum frequency of 1KHz in mind. Going to extend it later.
So any frequency lower than 1KHz will be displayed as 0
There is one thing I need to add, but not sure if It will improve it or not.
Also there will be following errors: These will be fine since variables are wrote to first but in C.
Simulator does not know this since C is not simulated.

What I did not make clear (sorry mtqc76) is:
I designed with a minimum frequency of 1KHz in mind. Going to extend it later.
So any frequency lower than 1KHz will be displayed as 0
There is one thing I need to add, but not sure if It will improve it or not.
Also there will be following errors: These will be fine since variables are wrote to first but in C.
Simulator does not know this since C is not simulated.
- Attachments
-
- High Frequency Counter 16F877A FC5 V2.fcf
- (20.17 KiB) Downloaded 449 times
Martin
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
Re: Frequency counter 35 Mhz
Hi Martin
Ive just tried the counter with my xtal standard.
Its ok upto 250kHz but Im not able to get a reading above this.
Think the trouble is the signal level output is a lot lower at these frequencies, maybe not enough to trigger the counter.
250kHz leve = 500 mV
1MHz = 200mV
10MHz = 80mV
Ive just tried the counter with my xtal standard.
Its ok upto 250kHz but Im not able to get a reading above this.
Think the trouble is the signal level output is a lot lower at these frequencies, maybe not enough to trigger the counter.
250kHz leve = 500 mV
1MHz = 200mV
10MHz = 80mV
1 in 10 people understand binary, the other one doesn't !
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: Frequency counter 35 Mhz
Hi, all
I have followed this post for a time now and i started to wonder, based on John Crow his post.
When its really so that the average voltage drops when the frequency increases, and therefore the micrcontroller cannot read or react correctly, I suggest the following possible solution.
Why do you mtqc76 make a certain number of amplification circuits to boost the voltage up high enough so that the microcontroller can read you signal correctly,
If the frequency gets higher then you switch over to a different amplifier with a higher gain, the same goes for a lower frequency.
This is what I was thinking maybe you can do something with it.
Regards Jordy
I have followed this post for a time now and i started to wonder, based on John Crow his post.
When its really so that the average voltage drops when the frequency increases, and therefore the micrcontroller cannot read or react correctly, I suggest the following possible solution.
Why do you mtqc76 make a certain number of amplification circuits to boost the voltage up high enough so that the microcontroller can read you signal correctly,
If the frequency gets higher then you switch over to a different amplifier with a higher gain, the same goes for a lower frequency.
This is what I was thinking maybe you can do something with it.
Regards Jordy
the will to learn, should not be stopped by any price
Re: Frequency counter 35 Mhz
Ture sir,
If we build the circuit on proteus and simulate it then we will know that it is not working as supposed to be (though I am newbie, doing work on proteus is better than making hardware first) but i think there need something professionalism in making such counter. once it is done on proteus, then there should no problem in making rf amplifier of single transistor to make the input signal strong enough.
If we build the circuit on proteus and simulate it then we will know that it is not working as supposed to be (though I am newbie, doing work on proteus is better than making hardware first) but i think there need something professionalism in making such counter. once it is done on proteus, then there should no problem in making rf amplifier of single transistor to make the input signal strong enough.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Frequency counter 35 Mhz
Hello mtqc76,
I'm not saying counter will work up to high frequencies like 30 MHZ
But one fact is I tested it on hardware from 1 KHZ to 1 MHz, and reading on LCD was correct.
So when you say you tested frequency counter in proteus if you tested frequencies between 1KHz and 1MHz and it did not work,
then I would question Proteus.
Martin
AS for creating a flowchart and you stated your a beginner then there is a great learning resource center at:
http://www.matrixmultimedia.com/lc_index.php?p=7
There you can view examples and even free training courses.
Martin
I'm not saying counter will work up to high frequencies like 30 MHZ
But one fact is I tested it on hardware from 1 KHZ to 1 MHz, and reading on LCD was correct.
So when you say you tested frequency counter in proteus if you tested frequencies between 1KHz and 1MHz and it did not work,
then I would question Proteus.
Martin
AS for creating a flowchart and you stated your a beginner then there is a great learning resource center at:
http://www.matrixmultimedia.com/lc_index.php?p=7
There you can view examples and even free training courses.
Martin
Martin
Re: Frequency counter 35 Mhz
Thanks sir! I have been through those tut. Through those tut i was able to make UPS fcf. Senior like you are great assest to our community.
- STibor
- Posts: 263
- Joined: Fri Dec 16, 2011 3:20 pm
- Has thanked: 116 times
- Been thanked: 113 times
- Contact:
Re: Frequency counter 35 Mhz
It is a good example. Thank you!medelec35 wrote:Thanks guys for taking an intrest.
What I did not make clear (sorry mtqc76) is:
I designed with a minimum frequency of 1KHz in mind. Going to extend it later.
So any frequency lower than 1KHz will be displayed as 0
There is one thing I need to add, but not sure if It will improve it or not.
Also there will be following errors: These will be fine since variables are wrote to first but in C.
Simulator does not know this since C is not simulated.
If the microcontroller 40MHz, I use it, you need to modify the program?
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Frequency counter 35 Mhz
Hi Simpi,
Thanks.
As soon as I know that, I will see what I can do for you.
Martin
Thanks.
What is your target device and type of osc (internal, external etc).?STibor wrote: If the microcontroller 40MHz, I use it, you need to modify the program?
As soon as I know that, I will see what I can do for you.
Martin
Martin