Suppose that you had GPIOxPDDR and GPIOxPDOR registers what
Suppose that you had GPIOx_PDDR and GPIOx_PDOR registers, what you would do to drive Pin 4 Port x? See program lines at below, fill in the lines with appropriate Basic C code://assigning the pin as output while (TRUE) {//to set the line to Logic 1//after waiting for a time interval//to set the line to Logic 0//after waiting for a time interval}
Solution
(1) SIM_SCGC5 |= (1<<11); // PORTC Clock Enable
(2) PORTC_PCR4 &= ~(7<<7); // set PORTC4 MUX to 000 (disable)
PORTC_PCR4 |= (1<<7); // set PORTC4 MUX to 001 (GPIO)
(3) GPIOC_PDDR &= ~(1<<4); // set GPIOC4 input
