PIC IR Remote


Closed Thread
Results 1 to 2 of 2

Thread: PIC IR Remote

  1. #1
    Join Date
    Feb 2010
    Location
    Albuquerque
    Posts
    19

    Default PIC IR Remote

    What am I doing wrong?

    Code:
    pulse  var Word
    x      var byte
    signal var byte
    
    ANSEL = %00000000
    
    Start:
        Pulsin PORTC.3, 0, pulse
        if (pulse < 220) or (pulse > 260) then start
        
    signal = 0
    x = 1
    
    Loop:
        pulsin PORTC.3, 0, pulse
        if (pulse > 90) then ADD_X
        
        READ_IR:
        x = x * 2
        if (x = 255) then start
        
        serout PORTC.2, 2, [#signal]
        clear
        
        goto loop
        
    ADD_X:
        signal = signal + x
        goto read_ir
        
    end

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    that code does the serout and clears all variables every time you get 1 pulse larger than 90. It doesn't wait until you have received the whole signal.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

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