One Sony decoder chip comin up..
This should be easy to understand & modify for your PIC type. And you can easily change it to display buttons like channel-up, down, volume-up, down, etc..
This will print buttons #1 through #9. Buttons 0, channel, volume, etc will output the numeric values corresponding to buttons pressed.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 RC.3 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 pressed was ",#DBYTE,13,10] GOTO Main END
I know you don't care about the device codes like TV, VCR, etc, but it's easier to keep in-synch if you read these in anyway.





Bookmarks