Frequency counter 35 Mhz
Moderator: Benj
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
- 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
The target can be any microcontroller 18F series, 18F252, 18F1330, 18F2620, 18F4550.
Crystal frequency can be anything, but it is difficult to purchase a crystal 19.6608MHz.
Ex-3.2768MHz and frequencies would be perfect to be divided into binary.
Crystal frequency can be anything, but it is difficult to purchase a crystal 19.6608MHz.
Ex-3.2768MHz and frequencies would be perfect to be divided into binary.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Frequency counter 35 Mhz
I was only asking for target device, so I could alter configuration settings so it would work on your hardware.
If you don't have a particular device in mind, I will just pick a random one.
As for availablility of 19.6608MHz crystal:
RS components :
PN 130-8917
Or a wider range from Farnell
http://uk.farnell.com/jsp/search/browse ... 1%2B203436
(That's if you have access to these componies in your country of course )
Martin
If you don't have a particular device in mind, I will just pick a random one.
As for availablility of 19.6608MHz crystal:
RS components :
PN 130-8917
Or a wider range from Farnell
http://uk.farnell.com/jsp/search/browse ... 1%2B203436
(That's if you have access to these componies in your country of course )
Martin
Martin
- 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
Hi!
Of course, you can buy from Farnell, but expensive.
Added to the frequency meter, based on your program.
Of course, you can buy from Farnell, but expensive.
Added to the frequency meter, based on your program.
- Attachments
-
- frekimero18f252_2.fcf
- (14.64 KiB) Downloaded 392 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Frequency counter 35 Mhz
Hi Simpi,
I was working on the frequency counter this morning to extend the low frequency range.
Now the frequency counter works from 1Hz to several MHz
Still not sure on upper limit as simulation stops working at greater than 5MHz.
As for using on 18F range.
It should work with no adjustments to the flowchart except to configuration settings for your target device.
Thanks for your Flowchart, will take a look at it.
Martin
I was working on the frequency counter this morning to extend the low frequency range.
Now the frequency counter works from 1Hz to several MHz
Still not sure on upper limit as simulation stops working at greater than 5MHz.
As for using on 18F range.
It should work with no adjustments to the flowchart except to configuration settings for your target device.
Thanks for your Flowchart, will take a look at it.
Martin
- Attachments
-
- High Frequency Counter 16F877A FC5 V3.fcf
- (22.11 KiB) Downloaded 411 times
-
- High Frequency Counter 18F252.fcf
- (22.39 KiB) Downloaded 402 times
Martin
- 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
Thanks!
Problem in the 18F252fcd file, and all fcd file.
Timer1 int
And configuration:
Problem in the 18F252fcd file, and all fcd file.
Timer1 int
Code: Select all
Opt1_2Val="st_bit(intcon, PEIE);\nst_bit(t1con, T1OSCEN);\nst_bit(t1con, TMR1ON);\ncr_bit(t1con, TMR1CS);\n"
Code: Select all
Opt2_1Val="t1con = t1con & 0b10000111;\n"
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Frequency counter 35 Mhz
I tried your frequency counter with a 18F2523 at 40MHz (10MHz xtal, 4xPLL)
It works well. Tested up to 2MHz (displays 2000856Hz)
It works well. Tested up to 2MHz (displays 2000856Hz)
Martin
- 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
The final version.
System clock frequency: 40.96 MHz
System clock frequency: 40.96 MHz
- Attachments
-
- frekimero18f2620_6_p.fcf
- (17.52 KiB) Downloaded 356 times
-
- 18F252.fcd
- (14.62 KiB) Downloaded 342 times
-
- frekimero18f252_6_p.fcf
- (17.51 KiB) Downloaded 367 times
- 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
18F2620 modified FCD file.
- Attachments
-
- 18F2620.fcd
- (14.83 KiB) Downloaded 325 times
-
- Posts: 60
- Joined: Thu Nov 15, 2012 1:21 pm
- Has thanked: 14 times
- Been thanked: 4 times
- Contact:
Re: Frequency counter 35 Mhz
Hi some pic of te family 18F contain 4 TMR , so can I do a Frecouncy counter with four channels with te same pic ?
thanks
thanks
-
- Posts: 60
- Joined: Thu Nov 15, 2012 1:21 pm
- Has thanked: 14 times
- Been thanked: 4 times
- Contact:
Re: Frequency counter 35 Mhz
Hi
in medelec35's program , there are 2 lines
which one give us the result ? !
for exemple for 9khz I have this result
in medelec35's program , there are 2 lines
which one give us the result ? !
for exemple for 9khz I have this result
- Attachments
-
- 2.rar
- (169.96 KiB) Downloaded 270 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Frequency counter 35 Mhz
Hi nc56,
Its only the top line that displays the frequency, the bottom line was for testing purposes, and and be removed or ignored.
As for displaying the wrong frequency, You need to connect signal generator (set as frequency not period) to T1CKI (Pin 11) which is not connected to anything in your picture.
As for using 4 channels, I would guess no, since its using a timer (clock in) for the frequency input.
As its only a guess, I could be wrong of course
Martin
Its only the top line that displays the frequency, the bottom line was for testing purposes, and and be removed or ignored.
As for displaying the wrong frequency, You need to connect signal generator (set as frequency not period) to T1CKI (Pin 11) which is not connected to anything in your picture.
As for using 4 channels, I would guess no, since its using a timer (clock in) for the frequency input.
As its only a guess, I could be wrong of course
Martin
Martin
-
- Posts: 60
- Joined: Thu Nov 15, 2012 1:21 pm
- Has thanked: 14 times
- Been thanked: 4 times
- Contact:
Re: Frequency counter 35 Mhz
Hi modelec
when I connect the generator to T1CKI (Pin 11) ; the LCD shows always 0 Hz with any frequency
what's the problem ? I used the "High Frequency Counter 18F252.fcf" program
Thank you
when I connect the generator to T1CKI (Pin 11) ; the LCD shows always 0 Hz with any frequency
what's the problem ? I used the "High Frequency Counter 18F252.fcf" program
Thank you
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Frequency counter 35 Mhz
Have you tried with real hardware, or just a simulator.
Simulators sometimes don't work as well as we would like them too.
Can you try with real hardware please.
If then it still does not work, I will see if I can find the issue.
Simulators sometimes don't work as well as we would like them too.
Can you try with real hardware please.
If then it still does not work, I will see if I can find the issue.
Martin
-
- Posts: 60
- Joined: Thu Nov 15, 2012 1:21 pm
- Has thanked: 14 times
- Been thanked: 4 times
- Contact:
Re: Frequency counter 35 Mhz
Hello medelec35
yes it works in hardware ,minimum value 1hz, maximum value 3MHZ , can I modify somthing to achieve more than 3MHZ ?
thank you
yes it works in hardware ,minimum value 1hz, maximum value 3MHZ , can I modify somthing to achieve more than 3MHZ ?
thank you
-
- Posts: 60
- Joined: Thu Nov 15, 2012 1:21 pm
- Has thanked: 14 times
- Been thanked: 4 times
- Contact:
Re: Frequency counter 35 Mhz
Hi Martin
I tried to show the values only in HZ , for example 1khz bust be shown 1000 hz... but it didn' work
I changed this code :
FrequencyString = left$ (TempString,1)
FrequencyString = FrequencyString + "."
TempString = right$ (TempString,3)
FrequencyString = FrequencyString + TempString + "KHz "
to
FrequencyString = left$ (TempString,8)
TempString = right$ (TempString,8)
fin = FrequencyString + TempString + "Hz"
and I removed the Switch Gatetiming
it shows for 1200 hz : 12001200
I tried to show the values only in HZ , for example 1khz bust be shown 1000 hz... but it didn' work
I changed this code :
FrequencyString = left$ (TempString,1)
FrequencyString = FrequencyString + "."
TempString = right$ (TempString,3)
FrequencyString = FrequencyString + TempString + "KHz "
to
FrequencyString = left$ (TempString,8)
TempString = right$ (TempString,8)
fin = FrequencyString + TempString + "Hz"
and I removed the Switch Gatetiming
it shows for 1200 hz : 12001200
- Attachments
-
- testa.fcf
- (17.73 KiB) Downloaded 225 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Frequency counter 35 Mhz
Hi nc56,
I have not tested this Flowchart so its only guessing, but give it a go and let me know how you get on please.
Cheers
Martin
Edit: Removed attachment, and posted new link in a different post.
I have not tested this Flowchart so its only guessing, but give it a go and let me know how you get on please.
Cheers
Martin
Edit: Removed attachment, and posted new link in a different post.
Martin
-
- Posts: 60
- Joined: Thu Nov 15, 2012 1:21 pm
- Has thanked: 14 times
- Been thanked: 4 times
- Contact:
Re: Frequency counter 35 Mhz
ok , I will test it monday , please what about if I want frequency more than 3 MHZ ?
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Frequency counter 35 Mhz
Hi nc56
Frequecy counter I posted was only designed to auto range. Eg. show Hz, KHz or MHz.
For just Hz try this:
http://www.matrixmultimedia.com/mmforum ... =25#p41816
As I don't think what I posted will work for just Hz to be honest
Martin
Frequecy counter I posted was only designed to auto range. Eg. show Hz, KHz or MHz.
For just Hz try this:
http://www.matrixmultimedia.com/mmforum ... =25#p41816
As I don't think what I posted will work for just Hz to be honest
Martin
Martin
-
- Posts: 60
- Joined: Thu Nov 15, 2012 1:21 pm
- Has thanked: 14 times
- Been thanked: 4 times
- Contact:
Re: Frequency counter 35 Mhz
ok thank you martin
one only question how can ave a value of frequency > 3 MHZ
I m using a 40MZ external crystal , if I change it can I have better result ?
one only question how can ave a value of frequency > 3 MHZ
I m using a 40MZ external crystal , if I change it can I have better result ?
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Frequency counter 35 Mhz
Hi nc56,
No problem.
As for greater than 3MHz,
I'm not sure if it can to much higher.
This Frequency counter was only my theory so I wanted to post something that's got a higher range then the usual frequency counter posted.
This frequency counter works differently to the one that the original poster posted a link to, since gate is software controlled rather then hardware controlled.
So may never be as good.
No problem.
As for greater than 3MHz,
I'm not sure if it can to much higher.
This Frequency counter was only my theory so I wanted to post something that's got a higher range then the usual frequency counter posted.
This frequency counter works differently to the one that the original poster posted a link to, since gate is software controlled rather then hardware controlled.
So may never be as good.
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Frequency counter 35 Mhz
Hi Martin
What a very interesting program to measure frequencies up to higher values.
I tried you version High Frequency Counter 16F877A FC5 V3.fcf, but I found that it failed, due to the fact that it did not trigger on the T1CKI port (which is C0 for PIC12F19639), but on the inner oscillator. I changed the Timer1 settings in a version 4, which now triggers on the external signal. Frequencies up to 1-2 MHz can be measured.
But sometimes the program stops. Especially if you start without a signal the program does not detect any frequency anymore.
Do you have a solution?
Kind regards
Jan Lichtenbelt
What a very interesting program to measure frequencies up to higher values.
I tried you version High Frequency Counter 16F877A FC5 V3.fcf, but I found that it failed, due to the fact that it did not trigger on the T1CKI port (which is C0 for PIC12F19639), but on the inner oscillator. I changed the Timer1 settings in a version 4, which now triggers on the external signal. Frequencies up to 1-2 MHz can be measured.
But sometimes the program stops. Especially if you start without a signal the program does not detect any frequency anymore.
Do you have a solution?
Kind regards
Jan Lichtenbelt
- Attachments
-
- High Frequency Counter V4.fcf
- (25.66 KiB) Downloaded 213 times
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Frequency counter 35 Mhz
In the meantime, I found the problem and solved it.
Please find the timer of Martin, a little bit changed for the PIC12F1939 (19.66 MHz oscl.)
The frequency measured are 100 Hz to 2 MHz (my upper limit of the generator) in 4 digits.
The accuracy up to 1 MHz is <+0.1 % and <+0.6% for the range 1-2 MHz (error compared to the generator).
Additional is that in the range 100 Hz to 1 KHz a sampling time of 10 sec, necessary for the accuracy of 4 digits, will be shown on the LCD screen.
Please find the updated version 4.1
Kind regards
Jan Lichtenbelt
Please find the timer of Martin, a little bit changed for the PIC12F1939 (19.66 MHz oscl.)
The frequency measured are 100 Hz to 2 MHz (my upper limit of the generator) in 4 digits.
The accuracy up to 1 MHz is <+0.1 % and <+0.6% for the range 1-2 MHz (error compared to the generator).
Additional is that in the range 100 Hz to 1 KHz a sampling time of 10 sec, necessary for the accuracy of 4 digits, will be shown on the LCD screen.
Please find the updated version 4.1
Kind regards
Jan Lichtenbelt
- Attachments
-
- High Frequency Counter V4.1.fcf
- (25.58 KiB) Downloaded 269 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Frequency counter 35 Mhz
Thanks Jan,Jan Lichtenbelt wrote:Hi Martin
What a very interesting program to measure frequencies up to higher values.
It is a better way rather than using internal timers.
Also the auto ranging part is useful.
Thanks for converting it to run on 16F1939.
I'm glad the concept works, and you have solved the issue you had for your target device.
You have done a great job.
Martin
Martin