What is required to read PAD8 and PAD9?

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

What is required to read PAD8 and PAD9?

886件の閲覧回数
rzimmermann
Contributor I

I'm new to this processor family and need a bit of help understanding the pin setup.

I am using the DEVKIT-S12ZVC.  I want to do a simple read of a pin. 

I have the following code but fear there is more or I am doing something extra.

// Data Direction Register (Associated pin is configured as input)

DDRADH_DDRADH0 = 0;
DDRADH_DDRADH1 = 0;

// Digital Input Enable Register (Associated pin is configured as digital input)

DIENADH_DIENADH1 = 1;
DIENADH_DIENADH0 = 1;

// Port ADH Pull Device Enable Register (Pull device enabled)

PERADH_PERADH0 = 1;
PERADH_PERADH1 = 1;

//Port ADH Polarity Select Register (Pulldown device selected)
PPSADH_PPSADH0 = 1;
PPSADH_PPSADH1 = 1;

if(PTADH_PTADH1 != PTADH_PTADH0)
{
   asm nop;
}

I can understand setting the pull down since the DEVKIT has a capacitor on those lines. 

Setting the Digital Register is to enable the digital function and disable the analog function.

ADH and AHL are the only ports with the Digital Register. 

0 件の賞賛
返信
1 返信

779件の閲覧回数
dianabatrlova
NXP TechSupport
NXP TechSupport

Hi Roger,

I tested your code with Pullup on the AN9 (PAD9) and AN8 (PAD8) to detect short circuit on these pins and it works for me.

PPSADH_PPSADH0 = 0;
PPSADH_PPSADH1 = 0;

You can use PTADL to detect input state, but PTADL register is mainly used when the port is configured as an output. So, you may try reading the input state directly from Port Input Register (PTIADL). 

I hope it helps you.

Best regards,

Diana