AnsweredAssumed Answered

TWR-K60N512 GPIO Control

Question asked by Betsy Hurtado on Aug 21, 2013
Latest reply on Sep 2, 2013 by Betsy Hurtado

Hi, I am trying to control a specific pin of my tower (PTC13), but I am having some trouble with it. I am using the configuration ALT1 as the reference manual recommends for GPIO. I think I am missing some configuration and that the problem is related with the default configuration that is DISABLED for this pin. I used the same code for an other pin (PTD1) and it worked.  This is the code I am using:

 

#include "derivative.h" /* include peripheral declarations */

#include "MK60DZ10.h"

 

int main(void){

 

  SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK//Enable PortC clock gate

 

  PORTC_PCR13 |= PORT_PCR_MUX(1); //PTC13 as GPIO

  GPIOC_PDDR |= (1<<13); //configure GPIO as output

 

  for(;;) {

    GPIOC_PTOR |= (1<<13); //Toggle bit

  }

  return 0;

}

 

Thank You!

Outcomes