Exemplo n.º 1
0
///////////////////////////////////////////////////////////////////////////////
/// @brief		TIMER1 interrupt handler sub-routine
/// @param[in]	None
/// @return 	None
///////////////////////////////////////////////////////////////////////////////
void TIMER1_IRQHandler1(void)
{
//	if (TIM_GetIntCaptureStatus(LPC_TIM1,0))
//	{
//		TIM_ClearIntCapturePending(LPC_TIM1,0);
	if(TIM_GetIntStatus(LPC_TIM1, TIM_CR0_INT))	{
		TIM_ClearIntPending(LPC_TIM1, TIM_CR0_INT);
		uint32_t capt = TIM_GetCaptureValue(LPC_TIM1,0);
		uint32_t diff = capt - Timer1Capture0Value;
		if(diff > 5000) {
			if(Recv.index != 12) {
				GPIO_SetValue(TRIG_PORT, TRIG_PIN);
				tim_cr0_int_error++;
				GPIO_ClearValue(TRIG_PORT, TRIG_PIN);
			}
			Recv.index = 0;
		}
		else {
			if(Recv.index < MAX_CHANNELS && diff > 500 && diff < 2500) {
				Recv.channel[Recv.index] = diff;
			}
			Recv.index++;
		}
		Timer1Capture0Value = capt;
	}
}
Exemplo n.º 2
0
int Timer_delay_ms(int count)
{
	 // Initialize timer 0, prescale count time of 100uS
	TIM_ConfigStruct.PrescaleOption = TIM_PRESCALE_USVAL;
	TIM_ConfigStruct.PrescaleValue	= 1000;

	// use channel 0, MR0
	TIM_MatchConfigStruct.MatchChannel = 0;
	// Disable interrupt when MR0 matches the value in TC register
	TIM_MatchConfigStruct.IntOnMatch   = TRUE;
	//Enable reset on MR0: TIMER will reset if MR0 matches it
	TIM_MatchConfigStruct.ResetOnMatch = TRUE;
	//Stop on MR0 if MR0 matches it
	TIM_MatchConfigStruct.StopOnMatch  = FALSE;
	//Toggle MR0.0 pin if MR0 matches it
	TIM_MatchConfigStruct.ExtMatchOutputType =TIM_EXTMATCH_TOGGLE;
	// Set Match value, count value of 1000 (1000 * 100uS = 100mS --> 10Hz)
	TIM_MatchConfigStruct.MatchValue   = count;

	// Set configuration for Tim_config and Tim_MatchConfig
	TIM_Init(LPC_TIM0, TIM_TIMER_MODE,&TIM_ConfigStruct);
	TIM_ConfigMatch(LPC_TIM0,&TIM_MatchConfigStruct);
	TIM_Cmd(LPC_TIM0,ENABLE);
	// Wait for 1000 millisecond
		while(!(TIM_GetIntStatus(LPC_TIM0,TIM_MR0_INT)));
		TIM_ClearIntPending(LPC_TIM0,TIM_MR0_INT);

  return 0;
}
Exemplo n.º 3
0
/*********************************************************************//**
 * @brief		Timer 0 interrupt handler. This sub-routine will set/clear
 * 				two Phase A-B output pin to their phase state
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void TIMER0_IRQHandler(void)
{
	if (TIM_GetIntStatus(LPC_TIM0,TIM_MR0_INT)) {

		// Set/Clear phase A/B pin corresponding to their state
		switch (PhaseCnt) {
		case 0:
			GPIO_SetValue(0,PHASE_A_PIN);
			GPIO_ClearValue(0,PHASE_B_PIN);
			break;
		case 1:
			GPIO_SetValue(0, PHASE_A_PIN | PHASE_B_PIN);
			break;
		case 2:
			GPIO_SetValue(0, PHASE_B_PIN);
			GPIO_ClearValue(0, PHASE_A_PIN);
			break;
		case 3:
			GPIO_ClearValue(0, PHASE_A_PIN | PHASE_B_PIN);
			break;

		default:
			break;
		}

		// update PhaseCnt
		PhaseCnt = (PhaseCnt + 1) & 0x03;

		// Clear Timer 0 match interrupt pending
		TIM_ClearIntPending(LPC_TIM0,TIM_MR0_INT);
	}
}
Exemplo n.º 4
0
/*********************************************************************//**
 * @brief		Delay millisecond
 * @param[in]	time (ms)
 * @return 		None
 **********************************************************************/
void Timer_Wait(uint32_t time)
{
// Initialize timer 0, prescale count time of 1ms
	TIM_ConfigStruct.PrescaleOption = TIM_PRESCALE_USVAL;
	TIM_ConfigStruct.PrescaleValue	= 1000;
	// use channel 0, MR0
	TIM_MatchConfigStruct.MatchChannel = 0;
	// Enable interrupt when MR0 matches the value in TC register
	TIM_MatchConfigStruct.IntOnMatch   = TRUE;
	//Enable reset on MR0: TIMER will not reset if MR0 matches it
	TIM_MatchConfigStruct.ResetOnMatch = FALSE;
	//Stop on MR0 if MR0 matches it
	TIM_MatchConfigStruct.StopOnMatch  = TRUE;
	//do no thing for external output
	TIM_MatchConfigStruct.ExtMatchOutputType =TIM_EXTMATCH_NOTHING;
	// Set Match value, count value is time (timer * 1000uS =timer mS )
	TIM_MatchConfigStruct.MatchValue   = time;

	// Set configuration for Tim_config and Tim_MatchConfig
	TIM_Init(LPC_TIM0, TIM_TIMER_MODE,&TIM_ConfigStruct);
	TIM_ConfigMatch(LPC_TIM0,&TIM_MatchConfigStruct);
	// To start timer 0
	TIM_Cmd(LPC_TIM0,ENABLE);
	while ( !(TIM_GetIntStatus(LPC_TIM0,0)));
		TIM_ClearIntPending(LPC_TIM0,0);
}
Exemplo n.º 5
0
void TIMER1_IRQHandler(void){
//	xprintf("TIMER1_IRQ");
	if (TIM_GetIntStatus(LPC_TIM1,TIM_MR0_INT)){
		TIM_ClearIntPending(LPC_TIM1, TIM_MR0_INT);
		LatchIn();
	}
}
Exemplo n.º 6
0
void TIMER2_IRQHandler(void){
//	xprintf("TIMER2_IRQ\r\n");
	if (TIM_GetIntStatus(LPC_TIM2,TIM_MR0_INT)){
		TIM_ClearIntPending(LPC_TIM2, TIM_MR0_INT);
		LED_INT_OCCURED = 1;
	}
}
Exemplo n.º 7
0
/*********************************************************************//**
 * @brief 		TIMER3 interrupt handler
 * @param		None
 * @return 		None
 ***********************************************************************/
void TIMER3_IRQHandler(void)
{
	//duty cycle = 50%
	TIM_Cmd(LPC_TIM3,DISABLE);
	TIM_ClearIntPending(LPC_TIM3, TIM_MR0_INT);
	TIM_ResetCounter(LPC_TIM3);
	TIM_Cmd(LPC_TIM3,ENABLE);
}
Exemplo n.º 8
0
int c_entry(void)
{
	// Init LED port
	LED_Init();

	/*
	 * Initialize debug via UART
	 */
	debug_frmwrk_init();

	// print welcome screen
	print_menu();

	// Read back TimeOut flag to determine previous timeout reset
	if (WDT_ReadTimeOutFlag()){
		_DBG_(info1);
		// Clear WDT TimeOut
		WDT_ClrTimeOutFlag();
	} else{
		_DBG_(info2);
	}

	// Initialize WDT, IRC OSC, interrupt mode, timeout = 2000000 microsecond
	WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET);
	// Start watchdog with timeout given
	WDT_Start(WDT_TIMEOUT);

	// set timer 100 ms
	Timer_Wait(100);

	while (1){
		// Wait for 100 millisecond
		while ( !(TIM_GetIntStatus(LPC_TIM0,0)));
		TIM_ClearIntPending(LPC_TIM0,0);
		//turn on led
		FIO_ByteSetValue(2, 0, LED_PIN);

		// Wait for 100 millisecond
		while ( !(TIM_GetIntStatus(LPC_TIM0,0)));
		TIM_ClearIntPending(LPC_TIM0,0);
		//turn off led
		FIO_ByteClearValue(2, 0, LED_PIN);
	}

	return 0;
}
Exemplo n.º 9
0
void TIMER0_IRQHandler(void)
{
    if (TIM_GetIntStatus(LPC_TIM0, TIM_MR0_INT) != RESET)
    {
        TIM_ClearIntPending(LPC_TIM0, TIM_MR0_INT);
        rt_device_hwtimer_isr(&_timer0);
    }
}
Exemplo n.º 10
0
void TIMER32_0_IRQHandler()
{
    static unsigned int duty_counter_r = 0;
    static unsigned int duty_counter_g = 0;
    static unsigned int duty_counter_b = 0;
    static unsigned int bl_duty_counter = 0;

    static unsigned int period_counter = 0;
    static int activity_counter = 0;

    CoEnterISR();

    TIM_ClearIntPending(LPC_TMR32B0, TIM_MR0_INT);

    // 39.0625us activity indicator (for calibration)
    GPIO_ToggleBits(TIMER_ACTIVITY_PORT, TIMER_ACTIVITY_PIN);

    if( period_counter -- > 0 ) {
        if( duty_counter_r -- == 0 )
            GPIO_ResetBits(RED_PORT, RED_PIN);
        if( duty_counter_g -- == 0 )
            GPIO_ResetBits(GREEN_PORT, GREEN_PIN);
        if( duty_counter_b -- == 0 )
            GPIO_ResetBits(BLUE_PORT, BLUE_PIN);

        if (bl_duty_counter-- == 0)
            GPIO_ResetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN);
    }
    else {
        if( activity_counter ++ >= TICKS_PER_SECOND ) {
            activity_counter = 0;
            GPIO_ToggleBits(TIMER_ACTIVITY_PORT, TIMER_ACTIVITY_PIN);

            //if( device_mode == AMBIENT_TEMPERATURE )
            //    PLUGIN_Temperature_Update();
        }

        SEQ_Tick();
        duty_counter_r = SEQ_CurrentRed();
        duty_counter_r == 0 ? GPIO_ResetBits(RED_PORT, RED_PIN) : GPIO_SetBits(RED_PORT, RED_PIN);

        duty_counter_g = SEQ_CurrentGreen();
        duty_counter_g == 0 ? GPIO_ResetBits(GREEN_PORT, GREEN_PIN ) : GPIO_SetBits(GREEN_PORT, GREEN_PIN );

        duty_counter_b = SEQ_CurrentBlue();
        duty_counter_b == 0 ? GPIO_ResetBits(BLUE_PORT, BLUE_PIN ) : GPIO_SetBits(BLUE_PORT, BLUE_PIN );

        bl_duty_counter = backlite_power;
        bl_duty_counter == 0 ? GPIO_ResetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN) : GPIO_SetBits(LCD_BACKLITE_PORT, LCD_BACKLITE_PIN);

        period_counter = 255;
    }

    CoExitISR();
}
Exemplo n.º 11
0
void TIMER0_IRQHandler(void){
	char msg[BUFFLENGTH] = "";
	char* strPtr = &msg;
	if (TIM_GetIntStatus(LPC_TIM0, TIM_MR0_INT)== SET){
		TIM_Cmd(LPC_TIM0,DISABLE);
		TIM_ResetCounter(LPC_TIM0);
		tim0_flag = 1;
		TIM_Cmd(LPC_TIM0,ENABLE);
	}
  TIM_ClearIntPending(LPC_TIM0, TIM_MR0_INT);
}
Exemplo n.º 12
0
// stop the timer and disable interrupts
void disableHwTimer (uint16_t timerNum)
{
  /* Stop timer*/
  TIM_Cmd(pTimerRegs[timerNum], DISABLE);

  /* Clear timer pending interrupt */
  TIM_ClearIntPending(pTimerRegs[timerNum], TIM_MR0_INT);

  /* Disable interrupt for timer*/
  NVIC_DisableIRQ(TimerConfig[timerNum].TimerIrq);
}
Exemplo n.º 13
0
Arquivo: main.c Projeto: hem1/EMPR
void TIMER1_IRQHandler(void)
{	
	PWM_MATCHCFG_Type PWMMatchCfgDat;
        
	if (TIM_GetIntStatus(LPC_TIM1, TIM_MR1_INT)== SET)
        {
		amp += 0.5;
		freq += 100;
		
	}
        TIM_ClearIntPending(LPC_TIM1, TIM_MR1_INT);
}
Exemplo n.º 14
0
/*********************************************************************//**
 * @brief 		TIMER1 interrupt handler
 * @param		None
 * @return 		None
 ***********************************************************************/
void TIMER1_IRQHandler(void)
{
	//duty cycle = 25%
	TIM_Cmd(LPC_TIM1,DISABLE);
	TIM_ClearIntPending(LPC_TIM1, TIM_MR0_INT);
	TIM_ResetCounter(LPC_TIM1);
	if((PWM1_State == ENABLE))
	{
		TIM_UpdateMatchValue(LPC_TIM1,0, 200);
		PWM1_State = DISABLE;
	}
	else
	{
		TIM_UpdateMatchValue(LPC_TIM1,0, 600);
		PWM1_State = ENABLE;
	}
	TIM_Cmd(LPC_TIM1,ENABLE);
}
Exemplo n.º 15
0
/*********************************************************************//**
 * @brief 		TIMER0 interrupt handler
 * @param		None
 * @return 		None
 ***********************************************************************/
void TIMER0_IRQHandler(void)
{
	//duty cycle = 12.5%
	TIM_Cmd(LPC_TIM0,DISABLE);
	TIM_ClearIntPending(LPC_TIM0, TIM_MR0_INT);
	TIM_ResetCounter(LPC_TIM0);
	if((PWM0_State == ENABLE))
	{
		TIM_UpdateMatchValue(LPC_TIM0, 0, 100);
		PWM0_State = DISABLE;
	}
	else
	{
		TIM_UpdateMatchValue(LPC_TIM0, 0, 700);
		PWM0_State = ENABLE;
	}
	TIM_Cmd(LPC_TIM0,ENABLE);
}
Exemplo n.º 16
0
/*********************************************************************//**
 * @brief 		TIMER2 interrupt handler
 * @param		None
 * @return 		None
 ***********************************************************************/
void TIMER2_IRQHandler(void)
{
	//duty cycle = 37,5%
	TIM_Cmd(LPC_TIM2,DISABLE);
	TIM_ClearIntPending(LPC_TIM2, TIM_MR0_INT);
	TIM_ResetCounter(LPC_TIM2);
	if((PWM2_State == ENABLE))
	{
		TIM_UpdateMatchValue(LPC_TIM2,0, 300);
		PWM2_State = DISABLE;
	}
	else
	{
		TIM_UpdateMatchValue(LPC_TIM2,0, 500);
		PWM2_State = ENABLE;
	}
	TIM_Cmd(LPC_TIM2,ENABLE);
}
Exemplo n.º 17
0
/*********************************************************************//**
 * @brief	TIM3 interrupt handler sub-routine
 * @param	None
 * @return	None
 **********************************************************************/
void TIMER3_IRQHandler(void)
{
	if (TIM_GetIntStatus(LPC_TIM3, TIM_MR0_INT)== SET)
	{
		TIM_Cmd(LPC_TIM3,DISABLE);                 // Disable Timer
		TIM_ResetCounter(LPC_TIM3);
		if(toggle_tim3 == TRUE)
		{
			TIM_UpdateMatchValue(LPC_TIM3,0,T1*10);//MAT3.0
			toggle_tim3=FALSE;
		}
		else
		{
			TIM_UpdateMatchValue(LPC_TIM3,0,T2*10);
			toggle_tim3=TRUE;
		}
		TIM_Cmd(LPC_TIM3,ENABLE);                // Start Timer
	}
	TIM_ClearIntPending(LPC_TIM3, TIM_MR0_INT);  // clear Interrupt
}
Exemplo n.º 18
0
Arquivo: main.c Projeto: inf3ct3d/fmtr
void TIMER32_1_IRQHandler(void)
{
	/*  Clear the pending interrupt */
	frequency = LPC_TMR32B0->TC;
	TIM_Cmd(LPC_TMR32B0, DISABLE);
	TIM_ClearIntPending(LPC_TMR32B1, TIM_MR0_INT);
	TIM_Cmd(LPC_TMR32B1, DISABLE);
	if(blink) {
			GPIO_SetBits(PORT0, GPIO_Pin_7);
	}
	else {
		GPIO_ResetBits(PORT0, GPIO_Pin_7);
	}
	blink ^= 1;
	lcd_string("F = ", 2);
	lcdwriteint(frequency, 5);
	//SSP_SendData(LPC_SSP1, (uint16_t)frequency);
	LPC_TMR32B0->TC = 0;
	GPIO_PortIntCmd(PORT3, ENABLE);
}
Exemplo n.º 19
0
void TIMER0_IRQHandler ()
{
	if (TIM_GetIntStatus(LPC_TIM0, TIM_MR0_INT) == SET) {
		NVIC_DisableIRQ(TIMER0_IRQn); //disable interrupt, to prevent it from overlapping if it takes too long to process
    	TIM_ClearIntPending(LPC_TIM0,TIM_MR0_INT);
        TIM_ResetCounter(LPC_TIM0);

        #if DEBUG==1 && TRACE==1
		tty_writeln("Timer trigger");
		#endif

		if (scramble_mode) {
			scramble_timer_handler();
		} else {
	        filter_loop();
	    }

        cycle++; //used for sine wave generation
		if(cycle > frequency)
			cycle = 0;

        NVIC_EnableIRQ(TIMER0_IRQn);
	}
}
Exemplo n.º 20
0
void TIMER2_IRQHandler(  )
{
  GPIO_SetValue(0, 0x01<<9);
  TIM_ClearIntPending(LPC_TIM2, TIM_MR0_INT);
//  TIM_Cmd(LPC_TIM2, DISABLE);
}
Exemplo n.º 21
0
/*********************************************************************//**
 * @brief	TIM2 interrupt handler sub-routine
 * @param	None
 * @return	None
 **********************************************************************/
void TIMER2_IRQHandler(void)
{
	TIM_ClearIntPending(LPC_TIM2, TIM_MR0_INT);  // clear Interrupt
}
Exemplo n.º 22
0
void TIMER0_IRQHandler(void){
//	xprintf("TIMER0_IRQ");
	if (TIM_GetIntStatus(LPC_TIM0,TIM_MR0_INT)){
		TIM_ClearIntPending(LPC_TIM0, TIM_MR0_INT);
#if 0
		if(TOG[0])
//			FIO_SetValue(LED_LE_PORT, LED_LE_BIT);
			GPIO_SetValue(LED_4_PORT, LED_4_BIT);
		else
//			FIO_ClearValue(LED_LE_PORT, LED_LE_BIT);
			GPIO_ClearValue(LED_4_PORT, LED_4_BIT);
		TOG[0]=!TOG[0];
//		TIM_ClearIntPending(LPC_TIM0, TIM_MR0_INT);
//		return;
#endif
//		xprintf(INFO "RIT N=%d B=%x NXT_T=%d TX=%x\n",SENDSEQ,SEND_BIT,DELAY_TIME,LED_PRECALC[0][SEND_BIT]);

		//Setup new timing for next Timer
		DELAY_TIME=SEQ_TIME[SENDSEQ];
		SEND_BIT=SEQ_BIT[SENDSEQ];

		//Retart sequence if required
		SENDSEQ++;
		SENDSEQ>=no_SEQ_BITS ? SENDSEQ=0 : 0;

#ifdef DMA
//		xprintf("SEND_BIT:%d\n",SEND_BIT);
//		xprintf("DELAY_TIME:%d\n",DELAY_TIME);
		GPDMACfg.DMALLI = (uint32_t) &LinkerList[0][SEND_BIT][BufferNo];
		GPDMA_Setup(&GPDMACfg);
		GPDMA_ChannelCmd(0, ENABLE);
#endif
		TIM_UpdateMatchValue(LPC_TIM0,0,DELAY_TIME);
		FIO_SetValue(LED_OE_PORT, LED_OE_BIT);
#ifdef RxDMA
		GPDMA_ChannelCmd(1, ENABLE);
		uint8_t reg;
		for(reg=6; 0<reg;reg--){
			xprintf("%d ",reg-1);
#if 0
			if(BUFFER==1)
				SSP_SendData(LED_SPI_CHN, LED_PRECALC1[reg][SEND_BIT]);
			else
				SSP_SendData(LED_SPI_CHN, LED_PRECALC2[reg][SEND_BIT]);
#endif
			//WaitForSend();//Wait if TX buffer full
			//while(LED_SPI_CHN->SR & SSP_STAT_BUSY);
			while(SSP_GetStatus(LED_SPI_CHN, SSP_STAT_BUSY)){
			};
			SSP_SendData(LED_SPI_CHN, LED_PRECALC[reg-1][SEND_BIT]);
			xprintf("%4x ",(LED_PRECALC[reg-1][SEND_BIT]));
		}
		for(reg=12; reg>6;reg--){
			xprintf("%d ",reg-1);
#if 0
			if(BUFFER==1)
				SSP_SendData(LED_SPI_CHN, LED_PRECALC1[reg][SEND_BIT]);
			else
				SSP_SendData(LED_SPI_CHN, LED_PRECALC2[reg][SEND_BIT]);
#endif
			//WaitForSend();//Wait if TX buffer full
			while(SSP_GetStatus(LED_SPI_CHN, SSP_STAT_BUSY)){
			}
			SSP_SendData(LED_SPI_CHN, LED_PRECALC[reg-1][SEND_BIT]);
//			if (reg==7){
				xprintf("%4x ",(LED_PRECALC[reg-1][SEND_BIT]));
//			}
		}
		LatchIn();
#endif
/*		UPDATE_COUNT+=1;
		ATE_COUNT=0;
			LED_UPDATE_REQUIRED=1;
		}*/
	}
}
Exemplo n.º 23
0
void TIMER3_IRQHandler(void) {
  TIM_ClearIntPending(LPC_TIM3, TIM_MR0_INT);
  diskTick100Hz();
  joulesUpdateTotals100Hz();
}
Exemplo n.º 24
0
void tim_clearint(int dev) {
	TIM_ClearIntPending(tim_devs[dev], TIM_MR0_INT);
}
Exemplo n.º 25
0
int c_entry(void)
{
	// DeInit NVIC and SCBNVIC
	NVIC_DeInit();
	NVIC_SCBDeInit();

	/* Configure the NVIC Preemption Priority Bits:
	 * two (2) bits of preemption priority, six (6) bits of sub-priority.
	 * Since the Number of Bits used for Priority Levels is five (5), so the
	 * actual bit number of sub-priority is three (3)
	 */
	NVIC_SetPriorityGrouping(0x05);

	//  Set Vector table offset value
#if (__RAM_MODE__==1)
	NVIC_SetVTOR(0x10000000);
#else
	NVIC_SetVTOR(0x00000000);
#endif
	// Init LED port
	LED_Init();

	/* Init debug */
	debug_frmwrk_init();

	// print welcome screen
	print_menu();

	// Initialize timer 0, prescale count time of 100uS
	TIM_ConfigStruct.PrescaleOption = TIM_PRESCALE_USVAL;
	TIM_ConfigStruct.PrescaleValue	= 100;
	// use channel 0, MR0
	TIM_MatchConfigStruct.MatchChannel = 0;
	// Disable interrupt when MR0 matches the value in TC register
	TIM_MatchConfigStruct.IntOnMatch   = TRUE;
	//Enable reset on MR0: TIMER will reset if MR0 matches it
	TIM_MatchConfigStruct.ResetOnMatch = TRUE;
	//Stop on MR0 if MR0 matches it
	TIM_MatchConfigStruct.StopOnMatch  = FALSE;
	//Toggle MR0.0 pin if MR0 matches it
	TIM_MatchConfigStruct.ExtMatchOutputType =TIM_EXTMATCH_TOGGLE;
	// Set Match value, count value of 10000 (10000 * 100uS = 1S --> 1Hz)
	TIM_MatchConfigStruct.MatchValue   = 10000;

	// Set configuration for Tim_config and Tim_MatchConfig
	TIM_Init(LPC_TIM0, TIM_TIMER_MODE,&TIM_ConfigStruct);
	TIM_ConfigMatch(LPC_TIM0,&TIM_MatchConfigStruct);
	TIM_Cmd(LPC_TIM0,ENABLE);
	while (1)
	{

		// Wait for 1000 millisecond
		while ( !(TIM_GetIntStatus(LPC_TIM0,0)));

		{
		TIM_ClearIntPending(LPC_TIM0,0);
		//turn on led
		LPC_GPIO2->FIOSET = LED0_PIN;
		UART_Send(LPC_UART0, info1, sizeof(info1), BLOCKING);
		}

		// Wait for 1000 millisecond
		while ( !(TIM_GetIntStatus(LPC_TIM0,0)));
		{
		TIM_ClearIntPending(LPC_TIM0,0);
		//turn off led
		LPC_GPIO2->FIOCLR = LED0_PIN;
		UART_Send(LPC_UART0, info2, sizeof(info2), BLOCKING);
		}
	}
	TIM_DeInit(LPC_TIM0);
	return (1);
}
Exemplo n.º 26
0
void TIMER0_IRQHandler(void){
	TIM_ClearIntPending((LPC_TIM_TypeDef *) LPC_TIM0, TIM_MR0_INT);

	 (*tick_handler)();
}
Exemplo n.º 27
0
void Timer0_Stop(void)
{
      TIM_ClearIntPending(TIMER0,TIM_MR0_INT);
      TIM_Cmd(TIMER0,DISABLE);
}
Exemplo n.º 28
0
void Timer1_Stop(void)
{
      TIM_ClearIntPending(TIMER1,TIM_MR1_INT);
      TIM_Cmd(TIMER1,DISABLE);
}