38Khz Modulator


Closed Thread
Results 1 to 6 of 6

Thread: 38Khz Modulator

  1. #1
    Join Date
    Jun 2011
    Posts
    17

    Default 38Khz Modulator

    hello,

    Can anyone help with this?

    I wanted to make an IR data link, i can use the method described elsewhere using a 555 with pin 4 connected
    to my PIC, but i understand this can be unstable.

    So i was going to use two PIC's (or actual 3 if you include the decoder) one would provide the 38Khz and the other provides
    the serial out. (the receiver would be one of the 38Khz modules).

    I can produce the code to make the PIC output pretty close to the 38Khz, but i not sure how i can implement the serial in at the same
    time, how to turn on or off the 38Khz with the serial in.

    I have seen ASM code to do this, but i don't understand it.

    So what i am trying to do is output the serial on a 38Khz carrier, can anyone suggest how this can be achieved in code????

    Many Thanks


    Gordon.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,518


    Did you find this post helpful? Yes | No

    Default Re: 38Khz Modulator

    I'm not sure what you mean by turn the 38kHz on or off with the serial in. I suspect you mean how to modulate it with serial out?

    Since you haven't said what PIC you're using I'm going to assume it has a CCP module. Set that up to provide the 38kHz carrier, connect the IR-LED between the PWM output and the serial output (with a current limit resistor). Depending on which way you connect the LED you'll get "true" or "inverted" output.

    If you want to push more current thru the LED than the PIC can supply (~25mA) then simply AND the two signals (PWM and serial) and use the output to drive the LED via a MOSFET or whatever.

    /Henrik.

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: 38Khz Modulator

    Here's one way if you have a 16F1827 http://www.picbasic.co.uk/forum/show...4227#post84227

    And another way http://www.rentron.com/Micro-Bot/IR_Serial.htm with any PIC with hardware PWM.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    Jun 2011
    Posts
    17


    Did you find this post helpful? Yes | No

    Default Re: 38Khz Modulator

    Hi Henrik / Bruce,

    Thankyou for the pointers..

    I have been trying things out on various PIC's, but they all have PWM. What you have described is exactly what i am trying to do.

    I completly overlooked this.

    Thanks again,

    Gordon.

  5. #5
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default Re: 38Khz Modulator


  6. #6
    Join Date
    Jun 2011
    Posts
    17


    Did you find this post helpful? Yes | No

    Default Re: 38Khz Modulator

    Ok,

    I understood the electronics, but have have been looking at the datasheet for the 12F683.

    I am sure this is going to end up being a simple answer, but i have been looking at the duty cycle settings for the PWM, it's just not making
    sense to me!

    I have seem other posts, setting the CLPR1L to 13, which would be half (50%) of the 26uS period. But when i look at the calculation for the duty cycle in the
    datasheet i am not understanding. If you put 13 in the CLPR1L (ie. 1101), does this then add to CCP1CON 5:4, (i.e.00) to make 1101 00 = 52 - then 52*0.25*1=13uS........

    (0.25 Tosc & 1 prescaler).

    Also, why does it say in the datasheet, 10bit PWM. Max 20Khz?

    As you can tell i am still at the very start of understanding PIC programming.

    Gordon,,

Members who have read this thread : 1

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