This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

guide to blink led on MK20DX256

I am newbie in arm programming. I am using teensy 3.2 which has MK20DX256 microcontroller chip .and led is connected to PTC5 of MC.

i have written this code to blink LED

The project builds without error but hex file does not blink led. i am using teensyloader to program the board with hex file

here is my code 

////////////////////////////////////////////////////////////////////////////////////////////////

# include "MK20D7.h"
void delay(unsigned int );

int main(void)
{
SystemCoreClockUpdate(); /* Get Core Clock Frequency */
SysTick_Config(SystemCoreClock/1000); /* Generate interrupt each 1 ms */

PORTC->PCR[5]= 256; //declared as GPIO
PTC->PDDR=0x00000010;
while(1)
{
PTC->PDOR=0x00000010;
delay(500);
PTC->PDOR=0x00000000;
delay(500);
}

}

void delay(unsigned int ms)
{
unsigned int i,j;

for(i=0;i<ms;i++)
for(j=0;j<20000;j++);

}

////////////////////////////

please help me in finding what is wrong with this code