[1769] GPIO read ...

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

[1769] GPIO read ...

1,231 次查看
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 项奖励
回复
4 回复数

1,183 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bruno on Thu Jul 26 13:34:20 MST 2012
Thanks....
0 项奖励
回复

1,183 次查看
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 项奖励
回复

1,183 次查看
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 项奖励
回复

1,183 次查看
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 项奖励
回复