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?
解決済! 解決策の投稿を見る。
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
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