remote control 5

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
you're better off using a small atmel avr instead of a pic since you can use bascom-avr, a basic compiler, to write the decoder. Pretty simple. everyone knows how to program in basic and there's even functions specificly for RC5.

literally, it'll take you five minutes to write the software and flash the avr.

google RC5 for more info.

Sam.
 
here you can find an explanation about rc5:
http://kudelsko.free.fr/gradateur/rc5.htm

here's my implementation (in C)

void RC5Reception(void)
{
//Cette fonction va effectuer la réception rc5
//elle renseigne le code appareil et le code commande recu

unsigned char NbBits;

//On met les codes a zero
code = 0;
commande = 0;
repeat = 0;

//On attend que le signal passe a zero (IR a un)
while(!RC5_IN) {}

//Second bit de start
//on attend le prochain front
RC5WaitBit(!RC5_IN);
//On attend 1332uS, 3/4 bit
Delay1332US();

//on lit la répétition
if(RC5_IN) repeat = 1;
RC5WaitBit(!RC5_IN);
Delay1332US();

//on recoit les 5 bits du code
NbBits = 5;
while(NbBits)
{
//On décale a gauche
code = code << 1;

if(RC5_IN) code = code | 0b00000001;
RC5WaitBit(!RC5_IN);
Delay1332US();
NbBits--;
}

//Reception de la commande
NbBits = 6;
while(NbBits)
{
commande = commande <<1;

if(RC5_IN) commande = commande | 0b00000001;
RC5WaitBit(!RC5_IN);
Delay1332US();
NbBits--;
}

Delay1332US();
Delay1332US();
}

void RC5WaitBit(unsigned char code)
{
//cette fonction va permettre d'attendre le prochain front

unsigned char i,j;

//boucle, qui permet d'éviter de bloquer le pic en cas de mauvaise reception
for(i=0x2D; i!=0; i--)
{

//tempo
for(j=0x20;j!=0;j--) {}

//on vient lire le port IR
if(code == RC5_IN) return; //on a trouvé un changement de valeur
}
}

RC5_IN is RB0
the receiver (tsop1838) inverts the signal
the function is called by interrupt on falling edge
 
nbcd said:
hy all , can someone tell me how to decode an Remote Control version 5 signal .I must use a PIC. What is the general ideea that must be used to solve this problem.
Thanks.
Best regards.:smash:

Apart from the general idea's. A good (better?) way is to use a state machine (programmed into the controller).

Click my webpage below It's assembly though, but for a pic.

I have some 'happy customers' using this:D
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.