AnsweredAssumed Answered

GPIOs in ADuCRF101

Question asked by predi88 on Apr 26, 2012
Latest reply on Apr 27, 2012 by PatrickN

Hello,

 

We are working with ADuCRF101 (microcontroller + transceiver) and PIR sensor. The PIR sensor has a digital output of 3V. We want to introduce this digital signal in one available pin (for example P0.0). Then, we want that print a "1" in the screen (HyperTerminal) when the PIR sensor is working and "0" in the other case. We have developed the next code but we always have high level in the PIN (also without connection to the signal of PIR sensor). This is the code:

 

int main (void)

{

 

   // Initialise

   T3CON &= ~T3CON_ENABLE;  // Turn off watchdog

  

   GP1CON = GP1CON_CON0_UART0RXD | GP1CON_CON1_UART0TXD; // UART

   Urt_Init(UART_BAUD_19200);

   Urt_PinSetup(FALSE);  

   printf("ADuCRF101 test routine!\n");

 

   GP0CON = 0x0000;

   GP0OEN = 0x00;

   GP0PUL = 0x00;

  

   while(1)

      {

     

       if (GP0IN_IN0 == 1)

          printf("1");

       else

          printf("0");

      }

}

 

If you can help us, we will be very grateful.

 

Thank you

Outcomes