This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ez430-rf2500 Getting input to work

hi all,

i am using the RF430-rf2500 kit. and i am trying to trigger on an input.
it must do something untill the input is set.

source i got:

in mcuint:

P4DIR = 0x00;

 

void init(void){
  int x;
  int iDummy = 1;
  while(iDummy != 0)                                                           

  {  

    if (0x10 & P4IN)                                                            // zolang p5 niet 1 is.

    {
        BSP_TOGGLE_LED2();
        BSP_TOGGLE_LED1();         
        iDummy  = 0; 
    }
    else
    {                         
      for(x = 0; x < 400; x++)
      {}
      P2OUT ^= 0x01;
    }
  }

The input pin is 0.02 Volt and it already gets triggert al the time ...

tryed the folowing: hardwarewise

Ground - 1k resistor -
                                           >     Input Pin.
                  signal        - 

 

even then its getting 0x10 al the time :(.

 

anny1 know what i am doing wrong??

 

grtz

 

h2k

 

 

edit* it just seem its continuesly makeing that port 1 - 0 - 1 - 0 atleast the leds keep going on of on of on of.

  • i fixed it by doing the following: but it aint a perfect fix ofc.

     

    void init(void){

      int x;

      

      int iDummy =1;

      while(iDummy!= 10000)                                                           

      {  

       

        if (0x10 & P4IN)                                                        // zolang p5 niet 1 is.

        {

            iDummy++;

            BSP_TOGGLE_LED2();

            BSP_TOGGLE_LED1();         

        }

        else

        {      

          iDummy = 1;

          for(x = 0; x < 100; x++)

          {}

          P2OUT ^= 0x01;

        }

      }

    }