how to enable Alternative function of a PIN in S12XE device family

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

how to enable Alternative function of a PIN in S12XE device family

1,833 Views
haricharanreddy
Contributor II

I am developing ADC driver for  MC9S12XEP100 microcontroller. while going through data sheet I came to know that AD port is used for both Genral I/O Port and ADC input pins. but no where mentioned how to enable the alternative function of a pin (to use as ADC input pins). could someone help me in this query ... 

Thanks in Advance

for DATA SHEET click on below link

https://www.nxp.com/docs/en/data-sheet/MC9S12XEP100RMV1.pdf

4 Replies

1,153 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi Hari,

The available examples for the S12XEP100 on this link S12X Examples Pack could be useful.

Best regards,

Diana

1,153 Views
RadekS
NXP Employee
NXP Employee

Hi Hari,

ADC pins are always (for all S12(X/Z) families) at port AD. See figure 1-1 in RM:

PAD.png

This port is powered by VDDA/VSSA pins.

See also Table 2-2. Pin Functions and Priorities:
If there is more than one function associated with a pin, the priority is indicated by the position in the table from top (highest priority) to bottom (lowest priority).

PAD1.png

So, the PAD pins are by default configured as AD pins. When we want to use them as digital input, we have to enable digital input buffer in one of ATDDIEN registers (ATD0DIEN or ATD1DIEN)


I hope it helps you

Have a great day,
Radek

1,153 Views
haricharanreddy
Contributor II

Thank Radek Sestak for above information, still, I have one more doubt in the same Table 2-2  if you observe the last column

pastedImage_1.png

pastedImage_2.png

then what does it mean? You said earlier (in above reply ) by default it acts as ATD input Pins but it says It will act as GPIO after Reset. 

Am I understand it wrongly? If, please correct me.

Thanks in Advance:smileyhappy:

0 Kudos
Reply

1,153 Views
RadekS
NXP Employee
NXP Employee

Hi Hari,

You are right, good point.

Port AD is the quite special case. In fact, we can say that pins from AD port are GPIO pins with analog measurement capability.

So, you may still use them as digital input, digital output and even in these cases you may measure a voltage at these pins. This may be sometimes useful for example for overcurrent detection.

So, there isn’t any real priority between analog and GPIO functionality.

 

We can expect that some analog voltage will be connected to AD port pins. Therefore, the port AD pins are by default configured as input analog pins = with disabled input digital buffer. The voltage around VDDA/2 at digital input pin may cause increased power consumption (valid for all digital input pins). On another side, the enabled input buffer with pull-up/down may also affect ADC measurement results.

 

We may switch these pins to digital output mode by editing DDRAD registers anytime.

BTW: there is older application note AN2434 Input-Output Pin Drivers on HCS12 Family MCUs

http://www.nxp.com/files/microcontrollers/doc/app_note/AN2434.pdf 

However, this application note is not focused on port AD pins very well.

I hope it helps you.

Best regards

Radek