How use PTC3 as ADC and I/O ?

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

How use PTC3 as ADC and I/O ?

ソリューションへジャンプ
722件の閲覧回数
wendersonolivei
Contributor IV

Hi, i'm making a project with mc9so8sh8 and my hardwere makes me need to read one analog value on ptc3 and, other time, send a digital output form pct3. How i disable the adc and make the output? (After i need enable that, again)

 

tks!

ラベル(1)
タグ(4)
1 解決策
588件の閲覧回数
weapon
Senior Contributor I

Hi Oliveria,

You need to rewrite Pin Control Registers during the switching, please refer to section 9.3.8-9.3.10 of the datasheet. If one port is used as analop inputs, the corresponding bit in APCTLx should be cleared, otherwise it should be set.

Take PTC3 as an example,  the corresponding control bit is ADPC11(take a look at Table 9-1 in page 121, you can see relationship between AD Cpins and IO pins),  Setting ADPC11 when PTC3 is used be ADC and Clearing it when it is used as Digital IO.

B.R

XWP

元の投稿で解決策を見る

1 返信
589件の閲覧回数
weapon
Senior Contributor I

Hi Oliveria,

You need to rewrite Pin Control Registers during the switching, please refer to section 9.3.8-9.3.10 of the datasheet. If one port is used as analop inputs, the corresponding bit in APCTLx should be cleared, otherwise it should be set.

Take PTC3 as an example,  the corresponding control bit is ADPC11(take a look at Table 9-1 in page 121, you can see relationship between AD Cpins and IO pins),  Setting ADPC11 when PTC3 is used be ADC and Clearing it when it is used as Digital IO.

B.R

XWP