Device = 16F877A
Declare RC5In_Pin = PORTB.0 ' Choose port.pin for infrared sensor
Dim RC5_Word As Word ' Create a Word variable to receive the data
' Alias the Command byte to RC5_Word low byte
Dim RC5_Command As RC5_Word.LowByte
' Alias the System byte to RC5_Word high byte
Dim RC5_System As RC5_Word.HighByte
All_Digital = On ' Make all pins digital mode
Cls ' Clear the LCD
While 1 = 1 ' Create an infinite loop
Repeat
RC5_Word = RC5In ' Receive a signal from the infrared sensor
Print At 2, 1, Dec RC5_Word, " " ' Display the Command value
Until RC5_Command <> 255 ' Keep looking until a valid header found
Cls
Print At 1,1,"System ", Dec RC5_System, " " ' Display the System value
Print At 2,1,"Command ", Dec RC5_Command, " " ' Display the Command value
Wend