gpio problem on mcf52259

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

gpio problem on mcf52259

ソリューションへジャンプ
1,489件の閲覧回数
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 解決策
569件の閲覧回数
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 返信
570件の閲覧回数
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 件の賞賛
返信