AnsweredAssumed Answered

GPIO Config in K21D50

Question asked by Jithesh AR on Oct 25, 2013
Latest reply on Oct 25, 2013 by Jithesh AR

Hi all,


     I'm new to Freescale microcontrollers. I'm now using TWR-K21D50 board for one of my project. Initially i'm triying to control GPIO pins. I have to glow the D5 led connected to the PTD4 pin. I have put my code below. But not working.


void main(void)


    SIM_SCGC5 |= SIM_SCGC5_PORTD_MASK; // enabled clock for the portd

    PORTD_PCR4 = PORT_PCR_MUX(1); //selected gpio functionality for pin

    GPIOD_PDDR = GPIO_PDDR_PDD(4); //put as output pin configuration

    GPIOD_PCOR = GPIO_PCOR_PTCO(4); // to make my pin low to glow the led (anode connected to 3.3v and cathode to GPIO Pin)







Please help me to diagnose the problem in my code.