[1769] GPIO read ...

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[1769] GPIO read ...

1,225 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bruno on Mon Jul 23 10:49:33 MST 2012
Hello,
I need an example of GPIO for read...

If
LPC_GPIO2->FIODIR = 0x000000FF;
defined as Outputs *

How make for defined as input?
0 Kudos
Reply
4 Replies

1,177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bruno on Thu Jul 26 13:34:20 MST 2012
Thanks....
0 Kudos
Reply

1,177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Jul 24 00:49:34 MST 2012
Sorry, wasn't aware that someone is reading my posts :rolleyes:
0 Kudos
Reply

1,177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Tue Jul 24 00:45:45 MST 2012
Zero, shame on you!

Should be:
LPC_GPIO0->FIOSET = SWITCH;
0 Kudos
Reply

1,177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Jul 23 11:05:24 MST 2012
As already described here http://knowledgebase.nxp.com/showthread.php?t=2417


#define SWITCH (1 << 26)            //SWITCH input P0.26

LPC_GPIO0->FIODIR &=~SWITCH;        //set input
LPC_GPIO0->FIOSET = SWITCH;        //set high
...
if(LPC_GPIO0->FIOPIN & SWITCH)        //get pin 
{
//damned, pin is still high
}                                
else
{
//wow, it's pulled low
}
0 Kudos
Reply