Frequency Counter using PIC and PicBasic


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    @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
    Last edited by ero; - 27th January 2005 at 15:51.

Similar Threads

  1. using AND as an IF statement
    By dw_pic in forum mel PIC BASIC
    Replies: 27
    Last Post: - 8th June 2006, 19:05
  2. Need help deciding = BASCOM 0r PICBASIC
    By Chris DeHut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th January 2006, 17:38
  3. Replies: 22
    Last Post: - 12th July 2005, 18:39
  4. Pic To Pic Serial Communication?
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 5th February 2005, 01:59
  5. PicBasic Fundamentals
    By Billyc in forum General
    Replies: 9
    Last Post: - 4th May 2004, 11:04

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts