コード例 #1
0
ファイル: hal_board.c プロジェクト: Daan1992/WSN-Lab
// Timer A0 interrupt service routine
HAL_ISR_FUNCTION(HalBoardTimerRolloverIsr, TIMER0_A0_VECTOR)
{
  if (++halBrdTmrTick == halBrdTmrDly)
  {
    halBrdTmrDlyF = FALSE;
    __low_power_mode_off_on_exit();
  }
  if (!halBrdDlySleep)
  {
    __low_power_mode_off_on_exit();
  }
}
コード例 #2
0
ファイル: alarm_clock.c プロジェクト: msaunby/msp430-gadgets
__interrupt void Timer_A(void)
{
  switch( TAIV )
  {
    //case  2:     // CCR1 not used
    //case  4:     // CCR2 not used
    //	break;
    case 10:
    	if(set_alarm){
    	  disp_on ^= 1;
    	}else{
    		disp_on = 1;
    	}
    	ticks++;
    	if(ticks==120){incr_clock(digits,1);ticks=0;}
    	//
    	if((digits[0]==alarm[0])&&(digits[1]==alarm[1])&&(digits[2]==alarm[2])&&(digits[3]==alarm[3])){
    	  do_alarm |= 0x1;
    	}else{
    		do_alarm = 0;
    	}
    	// For testing use -
    	// incr_clock(1);
    	if(disp_show_count)disp_show_count--;
    	break;
    default:
    	break;
  }
  __low_power_mode_off_on_exit();
}
コード例 #3
0
ファイル: UART_GPIO.c プロジェクト: levinet1991/msp430
__interrupt void TimerA0_ISR (void)
{                        
  if(UART_mode == UART_TRANSMITTING) {
    CCR0 += ONE_BIT_TIME;			// Add Offset to CCR0  
    
    if ( UART_bits_ctr == 0) {		
      // If all bits TXed
      UART_mode = UART_IDLE;
      
      TACTL_bit.TAMC &= 0;	// timer off (for power consumption)
      CCTL0 &= ~ CCIE ;		// Disable interrupt
      __low_power_mode_off_on_exit();
      ACT_LED =0;
    }
    else {
      if (UART_tx_char & 0x01) {
        P1OUT |= TXD;
      }
      else {
        P1OUT &= ~TXD;
      }
      UART_tx_char >>= 1;
      UART_bits_ctr--;
    }
  } else {
コード例 #4
0
ファイル: main.c プロジェクト: elpurofresh/codeComposer
__interrupt void Port_1(void)
{
	P1OUT |= LED2;
	__delay_cycles(100);

	//TACCTL0 ^= CCIE;			// Toggle the timer interrupt enable

	if (flag == 1) {
		TACCTL0 &= ~CCIE;
		TA0CCR0 = 0;

		flag = 0;
	} else {
		TA0CCR0 = 32768-1;
		TACCTL0 |= CCIE;

		flag = 1;
	}

	P1IES ^= BIT5;				// Change the edge detection from Lo/Hi <-> Hi/Lo
	P1IFG &= ~BIT5;         	// Clear P1.5 IFG

	P1OUT &= ~LED2;

	__low_power_mode_off_on_exit();    // Restores active mode on return
}
コード例 #5
0
__interrupt void ioPort2Isr(void)
{
    register uint_fast8_t ui8IntBm, ui8IsrBm;

    //
    // Get bitmask of pins with interrupt triggered (and interrupt enabled)
    //
    ui8IntBm = P2IFG;
    ui8IntBm &= P2IE;

    //
    // Create bitmask of pins with interrupt _and_ custom isr
    //
    ui8IsrBm = (ui8IntBm & ioPort2PinHasIsr);

    if((ui8IsrBm & BIT0))
    {
        (*ioPort2IsrTable[0])();
    }
    if((ui8IsrBm & BIT1))
    {
        (*ioPort2IsrTable[1])();
    }
    if((ui8IsrBm & BIT2))
    {
        (*ioPort2IsrTable[2])();
    }
    if((ui8IsrBm & BIT3))
    {
        (*ioPort2IsrTable[3])();
    }
    if((ui8IsrBm & BIT4))
    {
        (*ioPort2IsrTable[4])();
    }
    if((ui8IsrBm & BIT5))
    {
        (*ioPort2IsrTable[5])();
    }
    if((ui8IsrBm & BIT6))
    {
        (*ioPort2IsrTable[6])();
    }
    if((ui8IsrBm & BIT7))
    {
        (*ioPort2IsrTable[7])();
    }

    //
    // Clear pin interrupt flags (custom isr or not)
    //
    P2IFG &= (~ui8IntBm);

#ifndef IO_PIN_KEEP_POWER_MODE_ON_EXIT
    //
    // Turn off low power mode
    //
    __low_power_mode_off_on_exit();
#endif
}
コード例 #6
0
__interrupt void TIMER0_A1_ISR(void)
{
  if (fptr != NULL)
  {
      (*fptr)();
  }
  __low_power_mode_off_on_exit();
}
コード例 #7
0
ファイル: hal_timer_32k.c プロジェクト: ericyao2013/openwsn
__interrupt void timer32k0_ISR(void)
{
    if (fptr != NULL)
    {
        (*fptr)();
    }
    __low_power_mode_off_on_exit();
}
コード例 #8
0
ファイル: main.c プロジェクト: RyanMentley/MS-TEA-430
__interrupt void TIMERA0_ISR(void)
{
  gTimerTicks++;			// Add one to the timer counter
  ADC10CTL0 |= ADC10SC;			// Start another conversion
  TACCTL0 &= ~CCIFG;			// Clear the timer interrupt flag
  gState |= TATICK;			// Set the state so that the main loop will check the elapsed time
  __low_power_mode_off_on_exit();	// Wake the processor when this ISR exits
}
コード例 #9
0
ファイル: main.c プロジェクト: elpurofresh/codeComposer
__interrupt void Timer_A(void)
{
	P1OUT |= LED1;
	P1OUT |= BIT4;

	P1OUT &= BIT4;
	P1OUT &= LED1;

	__low_power_mode_off_on_exit();    // Restores active mode on return
}
コード例 #10
0
ファイル: bsp.c プロジェクト: MCUapps/gpn-gnu
__interrupt void timerA_ISR(void) {
#ifdef NDEBUG
    __low_power_mode_off_on_exit();
#endif
    QK_ISR_ENTRY();                       /* inform QK-nano about ISR entry */

    QF_tickISR();

    QK_ISR_EXIT();                         /* inform QK-nano about ISR exit */
}
コード例 #11
0
ファイル: bsp.c プロジェクト: michaeltandy/qpc
    void TIMER0_A0_ISR (void)
#else
    #error Compiler not supported!
#endif
{
#ifdef NDEBUG
    __low_power_mode_off_on_exit(); /* see NOTE1 */
#endif

    QF_TICK_X(0U, (void *)0);  /* process all time events at rate 0 */
}
コード例 #12
0
ファイル: bsp.c プロジェクト: MCUapps/qpc-gnu
__interrupt void port1_ISR(void) {                           /* for testing */
    static const QEvt tstEvt = { MAX_SIG, 0U, 0U };

#ifdef NDEBUG
    __low_power_mode_off_on_exit();
#endif

    P1IFG &= ~BIT2;                               /* clear interrupt source */

    QACTIVE_POST(AO_Table, &tstEvt, (void *)0);
}
コード例 #13
0
ファイル: bsp.cpp プロジェクト: dgu123/qpcpp
    void __attribute__ ((interrupt(TIMER0_A0_VECTOR))) TIMER0_A0_ISR (void)
#else
    #error Compiler not supported!
#endif
{
#ifdef NDEBUG
    __low_power_mode_off_on_exit(); /* see NOTE1 */
#endif

    TACTL &= ~TAIFG;   // clear the interrupt pending flag
    QF::TICK_X(0U, (void *)0); // process time events for rate 0
}
コード例 #14
0
ファイル: bsp.c プロジェクト: MCUapps/qpc-gnu
__interrupt void timerA_ISR(void) {
#ifdef NDEBUG
    __low_power_mode_off_on_exit();
#endif

#ifdef Q_SPY
    TACTL &= ~TAIFG;                    /* clear the interrupt pending flag */
    QS_tickTime_ +=
       (((BSP_SMCLK / 8) + BSP_TICKS_PER_SEC/2) / BSP_TICKS_PER_SEC) + 1;
#endif

    QF_TICK(&l_timerA_ISR);
}
コード例 #15
0
ファイル: bsp.c プロジェクト: MCUapps/gpn-gnu
__interrupt void port1_ISR(void) {                           /* for testing */
#ifdef NDEBUG
    __low_power_mode_off_on_exit();
#endif

    P1IFG &= ~BIT3;                               /* clear interrupt source */

    QK_ISR_ENTRY();                     /* inform QK kernel about ISR entry */

    QActive_postISR((QActive *)&AO_Ped, TEST_SIG, 0);    /* post test event */

    QK_ISR_EXIT();                       /* inform QK kernel about ISR exit */
}
コード例 #16
0
__interrupt void TIMER0_B0_ISR_HOOK(void)
{
    /* USER CODE START (section: TIMER0_B0_ISR_HOOK) */
	// this interrupt happens every 1/8 second
	P2OUT &= ~ BIT7;				// turn the LED off
	if (P2IN & BIT2) P2OUT |= BIT7;	// mimic the TSB_PHNMON input
	if (++eightCount > 7)			// do nothing most of the time
	{ 	eightCount = 0 ;			// reset the counter every second
		if (++tamper_count > 9) tamper_count = 0 ;	// Check for a tamper condition every 10 seconds
		secCount--;									// decrement the time out countdown counter every second
		__low_power_mode_off_on_exit();				// Every second the main loop starts up again
	}
    /* USER CODE END (section: TIMER0_B0_ISR_HOOK) */
}
コード例 #17
0
ファイル: hal_timer.c プロジェクト: paoloach/zpowermeter
/*
 *   Interrupt Service for the timerB, channel 0, output compare mode
 */
INTERRUPT_TIMERB_OC_CC0()
{
#if (defined HAL_TIMER) && (HAL_TIMER == TRUE)

#ifdef POWER_SAVING
  __low_power_mode_off_on_exit();
#endif
  if (timerRecord[HAL_TIMER_B].intEnable)
  {
    halTimerSendCallBack ( HAL_TIMER_B, HAL_TIMER_CHANNEL_A, HAL_TIMER_CH_MODE_OUTPUT_COMPARE);
  }

#endif /* (defined HAL_TIMER) && (HAL_TIMER == TRUE) */
}
コード例 #18
0
ファイル: interrupts.c プロジェクト: lapridunshik/IVTM7-M9
__interrupt void uart_a0_isr(void)  

{  
  volatile Int8U     inbyte;
   
  switch(UCA0IV)
  {     
    case 2: inbyte=     UCA0RXBUF;         
    
  if(Flags.uart_end)
            {   
             if(inbyte == 0x0d)
              {
              Flags.uart_end= RxCounter=  TxPointer= UCA0STAT= 0;
              }
              break;
            }
    
            UCA0STAT=   0;
            if(!RxCounter && (inbyte != '$'))  break;
            if(inbyte == '$') RxCounter= 0;     
            if(RxCounter == UART_BUF_LEN) 
            { 
              RxCounter= 0; 
              break; 
            }  
            if(inbyte != 0x0d) 
            { 
              UartBuffer[RxCounter++]= inbyte; 
              break;
            }
            
            Flags.uart_recieve=  1;
            RXI_DISABLE;
            __low_power_mode_off_on_exit();
            break;
             
    case 4: if(UartBuffer[TxPointer] == 0x0d)
            {
              UCA0STAT=             UCLISTEN;   // clear error bits
              inbyte=               UCA0RXBUF;  // clear RXI_F
              RXI_ENABLE;
              TXI_DISABLE;
              Flags.uart_end= 1;
            }
            UCA0TXBUF= UartBuffer[TxPointer++];
            break;
  }  
}
コード例 #19
0
ファイル: bsp.c プロジェクト: MCUapps/qpc-gnu
__interrupt void port1_ISR(void) {                           /* for testing */
    static const QEvt tstEvt = { MAX_SIG, 0U, 0U };

#ifdef NDEBUG
    __low_power_mode_off_on_exit();
#endif

    P1IFG &= ~BIT2;                               /* clear interrupt source */

    QK_ISR_ENTRY();                     /* inform QK kernel about ISR entry */

    QACTIVE_POST(AO_Table, &tstEvt, (void *)0);

    QK_ISR_EXIT();                       /* inform QK kernel about ISR exit */
}
コード例 #20
0
ファイル: hal_key.c プロジェクト: flofeurstein/MTProj
/**************************************************************************************************
 * @fn      INTERRUPT_KEYBD
 *
 * @brief   Interrupt Service Routine for keyboard
 *
 * @param   None
 *
 * @return  None
 **************************************************************************************************/
INTERRUPT_KEYBD()
{
#if (HAL_KEY == TRUE)

#ifdef POWER_SAVING
  /* Must allow key interrupt to cancel sleep */
  __low_power_mode_off_on_exit();
#endif

  /* Clear depending interrupt */
  HAL_CLEAR_KEY_INT();

  /* A key is pressed, let HalKeyPoll routing handle the keys at a later time */
  osal_start_timerEx( Hal_TaskID, HAL_KEY_EVENT, 100 );
#endif /* HAL_KEY */
}
コード例 #21
0
ファイル: main.c プロジェクト: jmtirado/MorseMSP430G2533
__interrupt void RTI_T1_TACCR0(void)
{
    P1OUT_bit.P0 = LED_OFF; //Apagamos LED1
    P1OUT_bit.P6 = LED_OFF; //Apagamos LED2

    //Desactivamos TIMER
    TA1CCTL0_bit.CCIE = OFF; //Deshabilita interrupcion Timer1
    TA1CTL_bit.MC0 = OFF; //Detiene Timer1

    //Si hay tareas sal de bajo consumo
    if(task.total)
    {
        __low_power_mode_off_on_exit();
    }

}//end __interrupt void RTI_T1_TACCR0(void)
コード例 #22
0
ファイル: bsp.c プロジェクト: MCUapps/qpc-gnu
__interrupt void timerA_ISR(void) {
#ifdef NDEBUG
    __low_power_mode_off_on_exit();
#endif

    QK_ISR_ENTRY();                            /* inform QK about ISR entry */

#ifdef Q_SPY
    TACTL &= ~TAIFG;                    /* clear the interrupt pending flag */
    QS_tickTime_ +=
       (((BSP_SMCLK / 8) + BSP_TICKS_PER_SEC/2) / BSP_TICKS_PER_SEC) + 1;
#endif

    QF_TICK(&l_timerA_ISR);

    QK_ISR_EXIT();                              /* inform QK about ISR exit */
}
コード例 #23
0
ファイル: bsp.c プロジェクト: sesamemucho/qsm_study
    TIMER0_A0_ISR(void)
#else
    #error MSP430 compiler not supported!
#endif
{
    /* state of the button debouncing, see below */
    static struct ButtonsDebouncing {
        uint8_t depressed;
        uint8_t previous;
    } buttons = { (uint8_t)~0U, (uint8_t)~0U };
    uint8_t current;
    uint8_t tmp;
    TACTL &= ~TAIFG;   /* clear the interrupt pending flag */

#ifdef NDEBUG
    __low_power_mode_off_on_exit(); /* see NOTE1 */
#endif

#ifdef Q_SPY
    QS_tickTime_ +=
       (((BSP_SMCLK / 8) + BSP_TICKS_PER_SEC/2) / BSP_TICKS_PER_SEC) + 1;
#endif

    QF_TICK_X(0U, (void *)0);  /* process all time events at rate 0 */

    /* Perform the debouncing of buttons. The algorithm for debouncing
    * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle
    * and Michael Barr, page 71.
    */
    current = ~P1IN; /* read P1 port with the state of BTN1 */
    tmp = buttons.depressed; /* save the debounced depressed buttons */
    buttons.depressed |= (buttons.previous & current); /* set depressed */
    buttons.depressed &= (buttons.previous | current); /* clear released */
    buttons.previous   = current; /* update the history */
    tmp ^= buttons.depressed;     /* changed debounced depressed */
    if ((tmp & BTN1) != 0U) {     /* debounced BTN1 state changed? */
        if ((buttons.depressed & BTN1) != 0U) { /* is BTN1 depressed? */
            static QEvt const pauseEvt = { PAUSE_SIG, 0U, 0U};
            QF_PUBLISH(&pauseEvt, &l_timerA_ISR);
        }
        else {            /* the button is released */
            static QEvt const serveEvt = { SERVE_SIG, 0U, 0U};
            QF_PUBLISH(&serveEvt, &l_timerA_ISR);
        }
    }
}
コード例 #24
0
ファイル: hal_digio.c プロジェクト: gxp/node
/***********************************************************************************
* @fn      port2_ISR
*
* @brief   ISR framework for P2 digio interrupt
*
* @param   none
*
* @return  none
*/
HAL_ISR_FUNCTION(port2_ISR,PORT2)
{
    register uint8 i;
    if (P2IFG)
    {
        for (i = 0; i < 8; i++)
        {
            register const uint8 pinmask = 1 << i;
            if ((P2IFG & pinmask) && (P2IE & pinmask) && (port2_isr_tbl[i] != 0))
            {
                (*port2_isr_tbl[i])();
                P2IFG &= ~pinmask;
            }
        }
        __low_power_mode_off_on_exit();
    }
}
コード例 #25
0
ファイル: hal_digio2.c プロジェクト: javierisern/TrxEBCCS5
__interrupt void port2_ISR(void)
{
    register uint8 i;
    if (P2IFG)
    {
        for (i = 0; i < 8; i++)
        {
            register const uint8 bitmask = 1 << i;
            if ((P2IFG & bitmask) && (P2IE & bitmask) && (port2_isr_tbl[i] != 0))
            {
                (*port2_isr_tbl[i])();
                P2IFG &= ~bitmask;
            }
        }
        __low_power_mode_off_on_exit();
    }
}
コード例 #26
0
ファイル: hal_uart.c プロジェクト: idaohang/cleon
__interrupt void USCI_A1_VECTOR_ISR(void)
{
    unsigned char ucRxData;
    switch(__even_in_range(UCA1IV,12)){
        case  0: break;
        case  2: 
            ucRxData = UCA1RXBUF;
            SYS_USB_ReceiveFrame(ucRxData);
            // If a complete USB frame has received successfully, exit low-power-mode
            if(bFLAG_USBFrameReceived == _SET_){
                __low_power_mode_off_on_exit();
            }
            break;     
        case  4: break;
        case  6: break;
        case  8: break;
        case 10: break;
        case 12: break;
        default: break;
    }
}
コード例 #27
0
ファイル: interrupts.c プロジェクト: lapridunshik/IVTM7-M9
__interrupt void ta1_isr(void)
{          
  static U16   rtc;  
  
  TA1CTL &= ~TAIFG;

  // RTC 
  rtc += (TA1CCR0 + 1);
  if(rtc >= 1024)
  {
    rtc -= 1024;
   // if(GenClock1)     GenClock1--; ????????
    
  //  Rclock++;
    Flags.systick=    1;
    Flags.radio=      1;
    __low_power_mode_off_on_exit();                  // для сброса WDT и подсчета времени
  }
  
  
  
}
コード例 #28
0
ファイル: finish.c プロジェクト: olegv142/PhotoFinish
__interrupt void watchdog_timer(void)
{
	// Routine maintenance tasks
	int ir_div = ir_divider();
	int r = wc_update(&g_wc);
	if (r && g_state == st_started) {
		display_set_dp(1);
		display_bin(g_wc.d);
		if (r > WC_DIGITS)
			g_timeout = 1;
	}
	display_refresh();
	if (is_calibrating()) {
		P1OUT |= CALIB_LED;
	} else {
		P1OUT &= ~CALIB_LED;
	}
	if (g_no_ir) {
		g_no_ir = 0;
		++g_no_ir_gen;
		if (is_calibrating())
			beep(ir_div * 2);
	}
	if (g_beep) {
		if (g_beep > 0)
			--g_beep;
		P1OUT |= BEEP_BIT;
	} else {
		P1OUT &= ~BEEP_BIT;
	}
	if (ir_div) {
		if (++g_ir_timer >= ir_div) {
			g_ir_timer -= ir_div;
			g_ir_burst = IR_BURST_PULSES * 2;
		}
	}
	__low_power_mode_off_on_exit();
}
コード例 #29
0
ファイル: hardware.c プロジェクト: PDtan1293/RFID
__interrupt void TimerAhandler(void)
{	
	//unsigned char Register;
          unsigned char Register[2];

         //kputchar('V');
	stopCounter;
	
	//Register = IRQStatus;		//IRQ status register address
	//irqCLR;				//PORT2 interrupt flag clear
	//ReadSingle(&Register, 1);	//function call for single address read
					//IRQ status register has to be read
        Register[0] = IRQStatus;	/* IRQ status register address */
        Register[1] = IRQMask;		//Dummy read	
	//ReadSingle(Register, 2);	/* function call for single address read */
        //ReadCont(Register, 1);
        ReadCont(Register, 2);
       // ReadSingle(Register, 1);



        *Register = *Register & 0xF7;	//set the parity flag to 0

	
	//if(Register == 0x00)
        if(*Register == 0x00 || *Register == 0x80) //added code
          	//if(RXTXstate > 1)
                //  	i_reg = 0xFF;
        	//else
			i_reg = 0x00;
	else
		i_reg = 0x01;
	
	__low_power_mode_off_on_exit();
	
}//TimerAhandler
コード例 #30
0
ファイル: Uart.c プロジェクト: jerryfree/msp430
__interrupt void UartTx ()
{
    TxFlag=1;
    __low_power_mode_off_on_exit();
}