What's the best way to output 30 to 40 kHz from a 12F683 pin?


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2009
    Location
    Northeastern USA
    Posts
    4

    Thumbs down What's the best way to output 30 to 40 kHz from a 12F683 pin?

    Hi all -
    This forum has already been tons of help, but now I have a question I can't find the answer to. I'm trying to build a minimum parts IR transceiver using a 12F683. I'd like to encode the IR beam at either 30 or 40 kHz (selectable) to minimize ambient light and allow two units to operate in the same area without them getting confused. I've got an darlington pair to give me adequate current and am using encoded receivers, I just don't know if it's possible to code the switch routine in PBP or if I need to do it in assembly. It seems that the docs are telling my the freq is too high for HPWM. I'd like the IR signal to run constantly.

    Peace - Fiz

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    HPWM limit is as stated in your manual. To reach higher frequency, you need to write the PWM register manually. Use PICMultiCalc to find PR2 and Timer Prescaller value, then plug the DutyCycle values in CCP1CON and CCPR1L registers... double check your datasheet to confirm.

    PicMultiCalc download
    http://www.picbasic.co.uk/forum/atta...7&d=1225550328
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    T2CON = %00000100
    CCP1CON = %00001100
    CCPR1L = 50
    PR2 = x
    @8MHz, x=
    56 for +/- 34kHz
    54 for +/- 36kHz
    52 for +/- 38kHz
    48 for +/- 40kHz
    46 for +/- 42kHz

    Frequencies shown here are not 100% accurate but for most IR receivers, they'll work well.
    Roger

  4. #4
    Join Date
    May 2009
    Location
    Northeastern USA
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Thanks for the quick responses -

    I'll try the values you gave me out in the morning (I'm a teacher) at school. mister_e the URL you posted didn't work (it has an ellipsis ... in it). If possible I'd like to get that calculator since we're hoping to scale this up to use up to 8 different transmitter/receiver pair, though I anticipate having to do substantial filtering/additional encoding. But that's for another day...

    Thanks again - Fiz

    BTW mister_e I live just over the border in VT.

  5. #5
    Join Date
    May 2009
    Location
    Northeastern USA
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Found it on another post. Thanks a ton or is it tonne?

    Fiz

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    ton or tonne... both are the same to me
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Is this a K Type sensor?
    By jessey in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 21st November 2009, 14:55
  2. Help changing CCP3 output pin
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th July 2008, 03:30
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27
  4. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 04:46
  5. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 18:07

Members who have read this thread : 2

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