AnsweredAssumed Answered

What is required to read PAD8 and PAD9?

Question asked by Roger Zimmermann on Jul 13, 2018
Latest reply on Jul 17, 2018 by Diana Batrlova

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. 

Outcomes