iswu.c

来自「Mplab C30编译器」· C语言 代码 · 共 40 行

C
40
字号
#include "reset.h"

/********************************************************************
* Function Name     : isWU
* Description       : Checks whether wake up from SLEEP 
*                     is due to MCLR or Interrupt or POR or BOR.
* Parameters        : None
* Return Value      : Returns 2 for MCLR, 1 for interrupt, 
*                     3 for POR,4 for BOR.
*********************************************************************/

char isWU(void)
{
   if( RCONbits.SLEEP)
   {
       if(RCONbits.EXTR)
       {
           return 2;        /* wakeup is due to MCLR */
       }

       if(RCONbits.POR)
       {
		   return 3;        /* wakeup is due to POR */
       } 

#ifdef _BOR
	
       if(RCONbits.BOR)
       {   
           return 4;         /* wakeup is due to BOR */
       }

#endif

       else
           return 1;             /* else, wakeup is due to interrupt. */
   }
  return 0;       
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?