Cicles count


Closed Thread
Results 1 to 4 of 4

Thread: Cicles count

Hybrid View

  1. #1
    Join Date
    Jun 2004
    Posts
    43

    Question Cicles count

    Hello all,
    Maybe this is a stupid question, but .. I would really like to know the answer... I can not answer myself, reading the datasheets...
    So , basically I have a 16f628@20MHz and I want to input a 3.5MHz signal and to count from there 380 pulses. And during this count, to read serially a bit. after 380 is reached, read the next bit serially, and so on.
    Any help would be greatly appreciated.
    thanks a lot.

  2. #2
    Join Date
    Jan 2006
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    First, to measure 380 cycles of a 3.5MHz signal (at TTL level) use Timer1 as a counter. You can preload Timer1 registers with 65157 and when an overflow is reached, either use polling or interrupts to proceed with the next step. Timer1 can read much higher frequencies than 3.5MHz.
    Then, use the Hardware Uart during the counting for serial comms, just make sure you check to see if the counter overflow flag is set or an interrupt was issued.

    Hope this gives you a start.

    Zenon

  3. #3
    Join Date
    Jun 2004
    Posts
    43


    Did you find this post helpful? Yes | No

    Talking

    Thanks for your advice. I theory I know how to make it work.
    Thae problem is that after reading a lot of threads related to this topic, It's a big messup in my head related to TMR0.
    I know that this kind of question are not agreed around here, but... I would really need a working program which can count a few hundred cycles. I am testing it with 16f628a@20MHz
    Thanks in advance.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Thumbs up Compare !!!

    Hi, Mega

    TMR1 of the 16F628 has a feature called "CAPTURE" ... have a look to Microchip DATAs, and you'll see how it flags an interrupt for as much as you want counts ...

    Darrel's instant interrupts also look great here ...

    As a joke ... if ONLY 3.5 Mhz input must be counted ( hé, hé ... ) a NE567 PLL could make a good enabling gate command.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. COUNT is not counting again
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 19th June 2009, 04:52
  2. Can't get COUNT to count
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd March 2009, 23:14
  3. Multiplex Display with count comand
    By mdaweb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th October 2005, 04:09
  4. Count command
    By hawk72501 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th September 2005, 19:04
  5. count problem
    By servo260 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd December 2004, 15:05

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