MSP430F2013 - Beginer - convert signal in bits

Hello,

I want to control a led with a remote control. So i have put a IR-Receiver on the pin 1.1 of a msp430f2013 and a led on the pin 1.0.

This is the signal receive on the pin 1.1 :

http://upload.wikimedia.org/wikipedia/c … etails.jpg

But i don’t know how to transform this signal into bits.

Thanks for your answer, and sorry for my english i’m french.

This is what i have make (don’t work) :

#include "msp430.h"

void wait(int nombre) {
  unsigned int a;
  a = nombre;
  while (a != 0)
  {
    a--;
  }
}

int main(void)
{
  WDTCTL = WDTPW + WDTHOLD;             // Stop watchdog timer
  P1DIR |= 0x09; // Pin 1.1 en Input
  unsigned char pin;
  unsigned char nbrzero=0; // number of 0 since the last 1, if more than 16 zero followin, the "message" is end
  unsigned char tableau[32];
  unsigned char huit=0; // every 8 bits we increase i because their are 8 bits in a char so we write in the next char
  unsigned char i=0; // number for the array
  unsigned char capt = 0; // capture the signal (value = 0), don't capture the signal (value 1) 

  // "reset" the array
  while(i!=32)
  {
   tableau[i] = 0x00;
   i++; 
  }
  
  i = 0;
  for (;;)
  {
     // watch the state of pin 1.1
     pin = P1IN;
     pin &= 0x02;
     
     if( i == 31 ){ i=0; } // security in order not to have tableau[544545]
     
     if(pin == 0x02){
       
       if (capt == 0) { capt = 1; }
       if(huit == 8) { huit = 0; i++; }
       tableau[i] =  tableau[i] << 1; // Left shift of all the bits
       tableau[i] = tableau[i] + 1; // add bits 1
       nbrzero = 0;
       huit++;
     
     }
     else
     {
       if(capt == 1)
       {
        if(huit == 8) { huit = 0; i++; }
        tableau[i] =  tableau[i] << 1; // Left shift of all the bits
        nbrzero++;
        huit++;
       }
       
       if(nbrzero > 16) {
         capt = 0;
         nbrzero = 0;
         i=0;
         huit=0;
         tableau[31] = 0x00;

        // => Normaly when we arrive at this state, the array contains the bits send by the remote control but it don't work, i don't receive alwais the same bits


         while(i!=32)
         {
          tableau[i] = 0x00;
          i++; 
         }
         i = 0;
     
       }
       
     }
     wait(1900); // little delay
  }
  
  
 
}

Bonjour, ici l"Americ

The signal you are trying to read is modulated. When “ON”, the signal is actualy going on and off at 38KHz. Trying to demodulate this in software on an MSP might be very hard.

You likely want a bit of hardware between the remote receiver and the MSP. A chip that would demodulate the signal for you so that it would be a series on and off bits. You should research demodulators for a nice circuit.

A very simple circuit can be made with a 555 timer set up as a retrigerable one shot with a timeout just slightly longer than the 38KHz rate. Each pulse would reset te output high. Only when the signal goes low for a lenght of time would the output of the 555 timeout and drive its output low. This low rate signal you should be able to decode in the MSP.

Thanks a lot for your answer ! i will try with a demodulator.