PIC Beginner - Infrared Receiver and IR Protocol


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Posts
    9


    Did you find this post helpful? Yes | No

    Default IR and PIC16FXXX

    dhouston

    The wave image is a sample (part of the sony protocol).


    Try to test it using my code exactly as written.
    Ok. dhouston

    But 12F629 pic is not available for me. Just a few PIC model can buy in my country. I have to use 16F84A or 16F628A. Beside I use IR, not RF.
    I'm a beginner for pic so I've not familiar with DEBUG that used in your code.

    So I write code to PIC than I see the result of LED signal and Computer program.

    When I test it using your code exactly, what can I see the result from where? Can I use Infrared remote control? or I must built your transmitter to test receiver.

    I think I must to change some code.

    I do my best as you say!

    Thanks.

    Moe

  2. #2
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    The code I posted above in this thread is for IR. If you study it you will see that the method is identical to Lester's.

    I have one 12F629 sending the 32 bit codes and another receiving the codes. Instead of IR transmitter and receiver I have the transmitter PIC connected directly to the receiver PIC. I do not have an IR receiver handy. However, I've used the same basic code in devices which did have an IR receiver.

    I quickly modified a simple test program written for other purposes to display the DEBUG output. See the attachment. You should see the same output ($50$AF$42$BD) every 15 secs) in whatever terminal program you are using.

    As for DEBUG, read the manual - it's similar to SerOut and SerOut2.

    You should be able to use my code merely by changing the GPIO.x pins to whatever RA.x pins you are using. I haven't used a 16F84A in ages so I'm not going to write the conversion for you.
    Attached Images Attached Images  
    Last edited by dhouston; - 31st August 2009 at 16:56.

  3. #3
    Join Date
    Aug 2009
    Posts
    9


    Did you find this post helpful? Yes | No

    Thumbs up Two IR Protocol in one PIC

    I changed pin assign.

    The result is successfully done.

    I test ten different kind of DVD Remote. Key positions are changed but all are work well.

    Now I run my program for two different tasks using same key of two different remote (Sony and NEC Protocol).

    ** two ir protocol can use in same pic **

    Adouston,
    THANK YOU VERY MUCH for your kindly help.

    I read NEC protocol and compare code.

    Header is 9ms
    - no header found, restart
    If (stx<760) Then init
    Space between header and body is 4.5ms
    -wait space
    While PortA.2=1:Wend
    Each pulse is a 560µs long
    A logical "1" takes 2.25ms to transmit (pulse 560µs + space )
    a logical "0" is only half of that, being 1.125ms (pulse 560µs + space )

    Please let me know:
    1. How to calculate (pulse>100) is logic 1.
    2. and PULSIN_MAX 1140 . why do you use 1140

    I say again. Thanks.

    Moe.
    Last edited by komoe01; - 1st September 2009 at 08:55.

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by komoe01 View Post
    Please let me know:
    1. How to calculate (pulse>100) is logic 1.
    2. and PULSIN_MAX 1140 . why do you use 1140
    I normally use RF where pulses & spaces are slightly different. I did the conversions to IR quickly, from memory and doing the math in my head so both figures are a bit on the high side.

    IR transmitters (i.e. remotes) that used the NEC chip actually used numbers of carrier cycles as the unit of time rather than absolute number of µS. They were also battery operated so there could be some variation due to voltage variations. It is recommended to allow ±20% although that's probably generous with more modern remotes (the protocol has been around for about 40 years).

    120% of 900 = 1080 instead of 1140.

    With this method we are only able to measure the spaces which can be 0.56mS or 1.125mS. We just want to determine whether it is one or the other. A figure about halfway between the two values should work so 85 might be better than the 100 I used.

    The NEC protocol is used by many manufacturers and you will encounter some that do not adhere exactly to the values given in the NEC datasheet so you need to build in a little flexibility.
    Last edited by dhouston; - 1st September 2009 at 11:56.

  5. #5
    Join Date
    Aug 2009
    Posts
    9


    Did you find this post helpful? Yes | No

    Default End of Thread

    Thanks
    dhouston
    for your explanation.

    Thanks
    lester
    for your suggestion.

    Now I should stop this thread.


    Moe

Similar Threads

  1. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  2. PIC to PIC "wired" serial one-way communication - SERIN2/SEROUT2
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th April 2008, 20:02
  3. Infrared Receiver
    By emavil in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th December 2006, 01:03
  4. how to get pic to pic communication
    By kinsiro in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th August 2005, 17:12
  5. Can this IR Xmitter/Rcvr be improved?
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th August 2005, 11:27

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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