IR decoder Sony code Help


Closed Thread
Results 1 to 11 of 11

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: IR decoder Sony code Help

    This is pretty old, but should work if you have a standard 12-bit type Sony IR transmitter. It's one of the simplest routines I have for decoding Sony IR.

    Code:
    DEFINE OSC 4
    
    IR_PULSE VAR BYTE(12) ' IR data received
    INDEX VAR BYTE        ' Index pointer
    DBYTE VAR BYTE        ' IR data received
    
    Main:
       PULSIN PORTC.3,0,IR_PULSE         '// Read-in start pulse
       IF (IR_PULSE < 200) OR (IR_PULSE = 0) THEN Main
    
    Verify:                              '// Read, Decode, then verify data
       FOR Index = 0 TO 11               '// Setup to read-in 12 pulses
        PULSIN PORTC.3,0,IR_PULSE[Index] '// Read 12 low-going pulses on C3
       NEXT Index                        '// Loop x times
       
       DBYTE = $7F                       '// Start with all 1's and find each 0
       
       FOR Index = 0 TO 6                '// Get 7 "data" bits
        IF IR_PULSE[Index] < 100 THEN DBYTE.0[Index]=0 '// Less than 1mS = 0
       NEXT Index
       
       DBYTE = DBYTE + 1                 '// Button code #1 = 0, Button #2 = 1, so add 1
                                         '// for actual button pressed for display
      
       HSEROUT ["Button #",#DBYTE," was pressed",13,10]
       GOTO Main
       
       END
    It's easy to change to pretty much any I/O-pin you want.
    Regards,

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

  2. #2
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: IR decoder Sony code Help

    Hi Bruce,

    Just curious if you know how much memory that code takes up considering the use of the array?

    Cheerful regards, Mike

Members who have read this thread : 0

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