How use PTC3 as ADC and I/O ?

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

How use PTC3 as ADC and I/O ?

跳至解决方案
698 次查看
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 解答
564 次查看
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 回复
565 次查看
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