This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Unable to configure Port 1 as input.

Dear Team,

Greetings,

I am facing a problem for configuring Port 1 as input. I have connected a push button on P1.4 and an led on P0.0. I want to perform a simple task, i.e. when I press button then LED must turn on, else LED must be off. I have used NRF24LE1, 32 pin package.

#include "reg24le1.h"

void main()
{
	P0DIR = 0x00;  // set PORT0 as output
	P1DIR = 0xff;  // set PORT1 as input
	while(1)  // infinite loop
	{
		if (P1 == 0x10)     // check P1.4 is high
		{
			P0 = 0x01;
		}
		else
		{
			P0 = 0x00;
		}
	}
}

Parents Reply Children
Related