IR Learner? Need ideas


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: IR Learner? Need ideas

    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 . "
    Last edited by Pimentel; - 4th April 2011 at 02:24. Reason: correction

  2. #2
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default Re: IR Learner? Need ideas

    Have somebody doing something like this (ir-remote, ir-learner, ir-repeater) but using RC10 protocol ?

  3. #3
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default Getting there...

    I have been reading a good example of somewhat what I need (requires modifications) at this page: http://home.citycable.ch/flotulopex/...I_Frames_e.htm

    Few questions have arisen in my mind about this code:
    1) Why in this code IRM_OUT is an output but being used as an input?
    Code:
    IRM_Out VAR PORTA.1 'IR RX Module VDD (OUT)
    TRISA      = %00000000 'Set Input/Output
    
    IRM_Out = 1                   'set port HIGH
    
    WHILE IRM_Out = 1 : WEND      'Wait here until a LOW signal is incoming
    FOR Ctr_A = 1 TO Max_Bit
        TMR1H = 0                 'Reset Timer 
        TMR1L = 0                 'Reset Timer 
        T1CON.0 = 1               'Start Timer
        WHILE IRM_Out = 0 : WEND  'stay here as long as input signal is LOW
        T1CON.0 = 0               'Stop Timer
        V_Tmr.LowByte  = TMR1L    ' \ 
        V_Tmr.HighByte = TMR1H    '  > Store data to LOW_BIT var
        L_Bit[Ctr_A]   = V_Tmr    ' /
        TMR1H = 0                 'Reset Timer 
        TMR1L = 0                 'Reset Timer 
        T1CON.0 = 1               'Start Timer
        WHILE IRM_Out = 1 : WEND  'stay here as long as input signal is HIGH
        T1CON.0 = 0               'Stop Timer
        V_Tmr.LowByte  = TMR1L    ' \
        V_Tmr.HighByte = TMR1H    '  > Store data to HIGH_BIT var
        H_Bit[Ctr_A]   = V_Tmr    ' /
    NEXT Ctr_A
    C_Led = 0
    PAUSE 1000                    'wait before continue
    2) It is declared that 'factor is a constant =0', then what does this routine do?
    Code:
    '______________________________________________________________
    ' Factorise (time compensation due to BASIC operations latency)
    FOR Ctr_A = 1 TO Max_Bit
        IF L_Bit[Ctr_A] >= Factor THEN L_Bit[Ctr_A] = L_Bit[Ctr_A] + Factor
        IF H_Bit[Ctr_A] >= Factor THEN H_Bit[Ctr_A] = H_Bit[Ctr_A] + Factor
    NEXT Ctr_A
    3) Also it will be much appreciated if someone can explain the following three routines as well, as this purpose is not clear to me
    Code:
    '_______________________________________________
    ' Rescale values (according to acquiring method???)
    FOR Ctr_A = 1 TO Max_Bit
        IF L_Bit[Ctr_A] > 0 THEN L_Bit[Ctr_A] = L_Bit[Ctr_A]/2
        IF H_Bit[Ctr_A] > 0 THEN H_Bit[Ctr_A] = H_Bit[Ctr_A]/2
    NEXT Ctr_A
     
    '______________________________________
    ' Find the longest H_Bit = interval bit
    '  This to determine how many bits in pattern
    FOR Ctr_A = 1 TO Max_Bit
        IF H_Bit[Ctr_A] > Itv_Bit THEN
            Itv_Bit = (H_Bit[Ctr_A] + 100) 'store the highest H_Bit value in Itv_Bit
            Bit_Cnt = Ctr_A            'is the count of bits in the original pattern --- How can bit_cnt count the bits in the original pattern if it only enters this loop if H_Bit[Ctr_A] > Itv_Bit
        ENDIF
    NEXT Ctr_A
     
    '___________________________________________________
    ' Replace all "after pattern" bits with value "zero"
    FOR Ctr_A = (Bit_Cnt + 1) TO Max_Bit
        L_Bit[Ctr_A] = 0
        H_Bit[Ctr_A] = 0
    NEXT Ctr_A

  4. #4
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default Re: IR Learner? Need ideas

    Anyone there???

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