Coding RF with SONY-PROTOCOL

Discussion in 'Wireless & RF Design' started by kazdin, Jan 12, 2015.

  1. kazdin

    Thread Starter New Member

    Jan 9, 2015
    2
    0
    hello everybody .
    I'm making a simple RF control using 433 modules and pic16f628 on both sides.The coding is adapted from SONY-PROTOCOL (the timings are divided by 2).
    The problem is :the receiver responds but sometimes erratically or with a miss.
    My ? is: Are the IR dedicated protocols(Sony,RC_5) not suitable at all for RF links?
     
  2. kazdin

    Thread Starter New Member

    Jan 9, 2015
    2
    0
    hello again.
    The problem is :the receiver responds but sometimes erratically or with a miss.
    This problem 's been solved when I added in my code: INTCON.GIE = 0; to give the priority to the main program when dealing with outputs...Well,I suppose this could be the reason of the errors.
    Code (Text):
    1.  
    2. while (1)                // wait here for the interrupt to occur
    3.     if (got_bits == 1) {
    4.        INTCON.GIE = 0;    // Global interrupt disabled (line added)
    5.        my_data_bits = my_data_bits & 0x7F;   // Keep the 7 command_bits
    6.        switch  (my_data_bits) {
    7.                case 1: PORTA.B0 = !PORTA.B0; break;  //Output_Relays
    8.                case 2: PORTA.B1 = !PORTA.B1; break;
    9.                case 3: PORTA.B2 = !PORTA.B2; break;
    10.                case 4: PORTA.B3 = !PORTA.B3; break;
    11.        }
    12.        delay_ms(1000);                       // for stabilisation
    13.        got_bits = 0;
    14.        INTCON.GIE = 1;                       // renable interrupts (line added)
    15.     }
    16. }                                            // End main()
    17. //-----------------------------------------------------------------------------
     
Loading...