I use the sony protocol. I think that is more easy to learning.
You can use some universal remote control (with sony protocol) to test and to learn.
My sample to help:
@ DEVICE pic16F628a, INTRC_OSC_NOCLKOUT ' System Clock Options
@ DEVICE pic16F628a, WDT_OFF ' Watchdog Timer
@ DEVICE pic16F628a, PWRT_OFF ' Power-On Timer
@ DEVICE pic16F628a, BOD_OFF ' Brown-Out Detect
@ DEVICE pic16F628a, MCLR_ON ' Master Clear Options (External)
@ DEVICE pic16F628a, LVP_OFF ' Low-Voltage Programming
@ DEVICE pic16F628a, CPD_OFF ' Data Memory Code Protect
@ DEVICE pic16F628a, PROTECT_OFF ' Program Code Protection
DEFINE OSC 4
'Definição das variáveis e declarações
INCLUDE "bs1defs.bas" 'inclui arquivo p/ compatibilizar com BS1
'p/entender as variáveis b0...b3, w0...w6 e bit0...bit13
CMCON = 7 'DEFINE PORTA COMO DIGITAL (COMPARADORES ANALÓGICOS:OFF)
symbol ir = PORTB.7 'entrada do sinal de IR
SYMBOL LED = PORTB.4
SYMBOL RELE = PORTB.0
TRISB = %10000000
'-------------------------------------------------------------------------------
PORTB = 0
LED = 1: PAUSE 100
'-------------------------------------------------------------------------------
'rotina principal
LOOP_1:
pulsin ir,0,w0 'wait start bit
if w0 < 200 then LOOP_1 'start bit is > 200
pause 20 'jump first sent
pulsin ir,0,b0 'wait 2º start bit
pulsin ir,0,b1
pulsin ir,0,b2 'read each bit from IR code
pulsin ir,0,b3
pulsin ir,0,b4
pulsin ir,0,b5
pulsin ir,0,b6
pulsin ir,0,b7
bit0=b1/96 ' LSB
bit1=b2/96
bit2=b3/96
bit3=b4/96
bit4=b5/96
bit5=b6/96
bit6=b7/96 ' MSB
bit7=0
if b0=21 then COMANDO 'test the values of your control
GOTO LOOP_1
COMANDO:
RELE = 1
LED = 1
PAUSE 500
RELE = 0
LED = 0
GOTO LOOP_1
'-------------------------------------------------------------------------------
end
Other article to learning from Experimenting_pbp.pdf:
"
Sony, infrared remote control Receiver
There are three main protocols used for the transmission and reception
of infrared signals . RC5, which is used by Philips, Rec-80, which is used
by Panasonic, and the Sony format (SIRCS), which will be described
here. Each form of infrared signalling has one thing in common, that is
the use of modulated infrared light. Modulation is used to enable a
certain amount of immunity from ambient light sources, especially
fluorescent lighting. The frequency of modulation varies from 36kHz to
40kHz, depending on the manufacturer . An infrared detector is required
to convert this modulated light into a digital signal . These are readily
available in just about every TV, VCR, and satellite receiver made within
the past 20 years . The type used for these series of experiments is the
Siemens SFH506-38, (unfortunately it's now out of production, but the
alternatives are the SFH5110 or the LT-1059) . These are small three
terminal devices that have a centre frequency of around 38kHz .
However, just about any type may be substituted, the only difference that
will be apparent will be a slight lack of range .
For the Sony protocol, the remote sends a start bit, sometimes called an
AGC pulse, that is 2.4ms in length . This allows the receiver to
synchronize, and adjust its automatic gain control, this occurs inside the
infrared detector module. After the start bit, the remote sends a series of
pulses . A 600us pulse represents a zero, and a 1200us pulse represents
a one, there is a 600us gap between each pulse. Not all manufacturers
stick stringently to these timings, so we will consider them as
approximates. All of these pulses build up a 12-bit serial signal called a
packet . This comprises of a 7-bit button value (the remote button
pressed), and a 5-bit device value (TV, VCR, etc) . The serial signal is
transmitted with the least significant bit sent first . "
Bookmarks