How use PTC3 as ADC and I/O ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How use PTC3 as ADC and I/O ?

Jump to solution
591 Views
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!

Labels (1)
Tags (4)
1 Solution
457 Views
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

View solution in original post

1 Reply
458 Views
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