gpio problem on mcf52259

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

gpio problem on mcf52259

跳至解决方案
1,785 次查看
robert_zhang
Contributor I

hi,all

i use gpio function on mcf52259 have following problem,i can read data throu porttc,but when i read data from porttc ,i cant read data from porttc,always is fffff.

do you know this problem?

标签 (1)
0 项奖励
回复
1 解答
865 次查看
mjbcswitzerland
Specialist V

Hi

 

This is a common mistake. The PORTTC register is an output register and, when read, returns the value in the output register. Therefore its doesn't return the pin states.

 

To read the port inputs you need to read from the SETTC register.

 

The same is generally true for all ports, that is, write outputs using PORTXX and read inputs using SETXX.

 

To make this less cryptic I have renamed the SETXX registers to PORTIN_SETXX.

 

Regards

 

Mark

 

www.uTasker.com

 

 

在原帖中查看解决方案

0 项奖励
回复
1 回复
866 次查看
mjbcswitzerland
Specialist V

Hi

 

This is a common mistake. The PORTTC register is an output register and, when read, returns the value in the output register. Therefore its doesn't return the pin states.

 

To read the port inputs you need to read from the SETTC register.

 

The same is generally true for all ports, that is, write outputs using PORTXX and read inputs using SETXX.

 

To make this less cryptic I have renamed the SETXX registers to PORTIN_SETXX.

 

Regards

 

Mark

 

www.uTasker.com

 

 

0 项奖励
回复