How do I get 3kHz signal?

Discussion in 'Embedded Systems and Microcontrollers' started by RG23, Feb 1, 2011.

  1. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    I am using PIC 16f887

    I have a timer of 10ms .

    I want to obtain 3Khz signal using this timer.

    If anyone has an idea please let me know

    Thank you
     
  2. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    You could use the PWM output to generate 3kHz.
     
  3. bertus

    Administrator

    Apr 5, 2008
    15,638
    2,343
    Hello,

    You will never manage 3kHz with a 10mS timer.
    The period time for 3 kHz is 1/3kHz = 0.333333 mS.
    The highest frequency with a 10 mS timer is 1/10mS = 100 Hz.

    Bertus
     
  4. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    988
  5. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    spinnaker [​IMG]
    Senior Member

    Actually its a different question

    If you have any idea please let me know
     
  6. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    You could use the PWM output to generate 3kHz
    _______________________________________________________________

    What is that PWM output?

    I have no idea on that
    Please elaborate
     
  7. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Check the CCP module in the datasheet. It's also handy for frequency generation.
     
  8. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    Check the CCP module in the datasheet. It's also handy for frequency generation
    ________________________________________________________________

    What was the PWM output you were talking about?

    Do let me know if I can actually create a 3kHz signal from 10 ms timer?

    Thank you
     
  9. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    10ms is only 100Hz, can't get 3kHz from that.
     
  10. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    988

    Actually it is. It is PWM. If you learn how to do one you will know how to do the other.

    But as we say in the States. "You are trying to get blood out of a stone". Meaning you are trying to do the impossible. As others pointed out, you need a much faster timer. Did you mean 10u seconds?

    You can do it with a timer but you would need a faster timer.


    It is actually easier to do it with PWM. Check the top of this subforum for a very nice post on how to do PWM. It is a sticky post.
     
  11. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Of course you could just use a common buzzer, they're around 2-3kHz.
     
  12. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
Loading...