Hi,
Please refer to the following posted example; https://community.freescale.com/docs/DOC-329563.
It gives you basic demo code. It also set one pin to GPIO output and toggle it within timer interrupt.
To set the pin as input you need to set the SIU.PCR[x].IBE bit and read the pad level from the respective SIU.GPDI[x] register.
For example like this
SIU.PCR[16].R = 0x0200; // set PB0 as GPIO output
SIU.PCR[17].R = 0x0103; // set PB1 as GPIO input, pull ups enabled
// if PB[0] pin is high then set PB[1] high, else put it low
if(SIU.GPDI[16].R) SIU.GPDO[17].R = 0x1;
else SIU.GPDO[17].R = 0;
BR, Petr
Hi,
Please refer to the following posted example; https://community.freescale.com/docs/DOC-329563.
It gives you basic demo code. It also set one pin to GPIO output and toggle it within timer interrupt.
To set the pin as input you need to set the SIU.PCR[x].IBE bit and read the pad level from the respective SIU.GPDI[x] register.
For example like this
SIU.PCR[16].R = 0x0200; // set PB0 as GPIO output
SIU.PCR[17].R = 0x0103; // set PB1 as GPIO input, pull ups enabled
// if PB[0] pin is high then set PB[1] high, else put it low
if(SIU.GPDI[16].R) SIU.GPDO[17].R = 0x1;
else SIU.GPDO[17].R = 0;
BR, Petr