/*
===============================================================================
Name : main.c
Author :
Version :
Copyright : Copyright (C)
Description : main definition
===============================================================================
*/
#ifdef __USE_CMSIS
#include "LPC17xx.h"
#endif
#include <cr_section_macros.h>
#include <NXP/crp.h>
// Variable to store CRP value in. Will be placed automatically
// by the linker when "Enable Code Read Protect" selected.
// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;
// TODO: insert other include files here
// TODO: insert other definitions and declarations here
int main(void)
{
LPC_GPIO2->FIODIR |= 1 << 29;
LPC_SC->PCONP |= 1 << 1;
LPC_SC->PCLKSEL0 |= 1 << 3;
LPC_TIM0->TCR |= 0x00000002;
LPC_TIM0->MCR |= 0x00000003;
LPC_TIM0->MR0 |= 6000000;
NVIC_EnableIRQ(TIMER0_IRQn);
LPC_TIM0->TCR |= 0x00000001;
while(1){}
return 0 ;
}
void TIMER0_IRQHandler (void)
{
if((LPC_TIM0->IR & 0x01) == 0x01)
{
LPC_TIM0->IR |= 1 << 0;
LPC_GPIO2->FIOPIN ^= 1 << 29;
}
}
|