Trouble setting output pins to pull down resistor mode

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

Trouble setting output pins to pull down resistor mode

ソリューションへジャンプ
1,792件の閲覧回数
injunear1
Contributor IV

I trying to read inputs on pins 1, 3, & 5 (PTB8, PTB9 & PTB10 respectively). I want to ground pins PTB9 and PTB10 for an input and connect PTB8 to P3V3 for an input. If I understand things correctly, this would mean that I set PTB8 for pull down and PTB9 & 10 for pull up.

Although I have been able to read PTB9 & 10 as expected, PTB8 always reads high. However, it reads a low when shorted to ground.

After looking at the control register for the pin (PORTB_PCR8) in the register view, it appears as though both the slew rate and pull up resistor are hard set to on.

I was not able to clear them with:

PORTB_PCR8 = (PORTB_PCR8 & 0xFFFFFFF8);

(FWIW, it appears the same is true for PORTB_PCR9 as well. And PORTB_PCR10 has the slew rate set off, but the pull up resistor seems to be hard coded on.)

Is this a bug or a "feature" or am I not using these pins correctly?

And where do I find a definition of "slew rate", please?


Thank you.

ラベル(1)
0 件の賞賛
返信
1 解決策
1,621件の閲覧回数
pgo
Senior Contributor V

Dear Injun,

You haven't specified which micro you are talking about.

However - The description of operation of the port registers is general.  A particular port may not implement all possible features.  There is usually another table indicating which features are available on which ports.

e.g. for the KL25

3.10.1.2 Port Control and Interrupt Summary

This confused me a lot as well!!

bye

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,622件の閲覧回数
pgo
Senior Contributor V

Dear Injun,

You haven't specified which micro you are talking about.

However - The description of operation of the port registers is general.  A particular port may not implement all possible features.  There is usually another table indicating which features are available on which ports.

e.g. for the KL25

3.10.1.2 Port Control and Interrupt Summary

This confused me a lot as well!!

bye

0 件の賞賛
返信
1,622件の閲覧回数
JimDon
Senior Contributor III

pgo is  correct. According to the table he has mentioned, PORTB has no pull select control implemented, so that would explain why your code seems to do nothing.

It also says "All the pins are hard wired to be pullup except for SWD_CLK."

1,622件の閲覧回数
JimDon
Senior Contributor III

I believe the correct setting for pull down would be bit 1 =  1 and bit 0 = 0, that is pull enable, use pull down.

0 件の賞賛
返信