I am a newbie in arm programming. I am using teensy 3.2 which has MK20DX256 microcontroller chip and the led is connected to PTC5 of MC.
I have written this code to blink the LED.
The project builds without error but HEX file does not blink led. I am using teensy loader 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