@steve,
Lets make a simple calculation;
- The osc frequency is 10.000.000 Hz.
- The pic working frequency is 10.000.000/4 = 2.500.000 Hz.
- The period of one command cycle is : 1.000.000/2.500.000=0,4 us. means 400 ns.
- max. frequency which will be measured 50.000.000 Hz.
- the quantity of puls in one second is 50.000.000
- in one ms = 50.000
- in one us = 50 (needs 125 command cycle for counting it).
As you have seen everything are in the range and there is no problem. According to these calculation the max. frequency which will be counted is 65.535 .000 Hz.
I checked a lot of time to count this frequency also. If you write a simple program as very few lines it is counting that frequency.
My program can count up to 50 Mhz.
Pls. do not consider the delays given on the program. These are the delays for pbp. I used asm section for the delays my real program which is more precision.
Normal periods should be as follows;
Mode 0: 1000 ms.
Mode 1: 100 ms.
Mode 2: 10 ms.
Mode 3: 1 ms.
If you want to count 50.000.000 Hz in one ms. you obtain 50.000 and you have only 16 bit TMR1 variable which can be max. 65.535 which is your max. counting figure in one ms. By the way the max. frequency will be 65.535.000 Hz.
My real program is interesting. It is having auto range function. Before writing this program I made some frequencymeters with pic. All of them was using a button to change the resolution and also the sampling time (mode). I decided to write my program it is working automatic on selceting the mode. There is no any button on my frq_meter. If you interest I can give you also the codes.
Regards
Ero
Ero




Bookmarks