Coding RF with SONY-PROTOCOL

Thread Starter

kazdin

Joined Jan 9, 2015
2
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?
 

Thread Starter

kazdin

Joined Jan 9, 2015
2
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:
while (1)                // wait here for the interrupt to occur
    if (got_bits == 1) {
       INTCON.GIE = 0;    // Global interrupt disabled (line added)
       my_data_bits = my_data_bits & 0x7F;   // Keep the 7 command_bits
       switch  (my_data_bits) {
               case 1: PORTA.B0 = !PORTA.B0; break;  //Output_Relays
               case 2: PORTA.B1 = !PORTA.B1; break;
               case 3: PORTA.B2 = !PORTA.B2; break;
               case 4: PORTA.B3 = !PORTA.B3; break;
       }
       delay_ms(1000);                       // for stabilisation
       got_bits = 0;
       INTCON.GIE = 1;                       // renable interrupts (line added)
    }
}                                            // End main()
//-----------------------------------------------------------------------------
 
Top