I am using an MC9S12E128 in which the PMF module is on the P port. I am trying to enable only PMF4 and 5 on Port P while using PP0-PP3 as inputs. I'm aware that a peripheral takes prescidence over its corresponding Port I/O statements, however there is a line in the datasheet that states:
"The PMF function takes precedence over the general-purpose I/O function if the associated PWM channel
is enabled. The PWM channels 5-0 are outputs if the respective channels are enabled."
The Datasheet seems a little foggy on how to disable PMF channels and use them as inputs. Here is a snippet of my initialization code:
PMFCFG0=0x5F; //Each pair of PMF's uses a different time base. A and B are edge aligned
// C is Center Aligned & are independent
PMFCFG1=0; //Positive polarity
PMFCFG3=0; //PMF's run in 'Wait & Freeze' modes, No pair swapping
PMFOUTC=0x0F; //Enable software control of PWM pin
PMFOUTB=0x30; //disable PWM0-3
PMFENCC=0; //Verify that timer C for PMF4 & 5 is disabled
x=PMFENCC; //Read register prior to writing a 1 to the LDOKC bit
PMFENCC=2; //Write a 1 to the LDOKC bit
DDRP=0x30; //Enable PT0-3 as inputs, PT4 and 5 are PWM
I'm sure there is are quite a few 9S12 Guru's out there who have encountered this before or have some words of wisdom. I prefer to use the configuration mentioned above due to an existing PCB layout.
What is the proper way to configure the PMF3 and PMF4 peripheral and PT0-3 as Input pins?