📄 irq.c
字号:
/* INCLUDE */
#include <hidef.h> /* for EnableInterrupts macro */
#include <MC68HC908GZ60.h> /* include peripheral declarations */
#include "COMMON.h"
#include "IRQ.h"
#include "TIM.h"
#include "INIT.h"
#include "VFD.h"
/* Global Variables */
extern UINT8 fanladder;
/*****************************************************************************
* Function: Power()
*
* Description: none
*
* Returns: none
*
* Notes: This handler is the interrupt function of Power switch
* interrupt.
*
*****************************************************************************/
void interrupt Power(void){
static UINT8 Power = ON;
static UINT8 fanladder_m;
static UINT8 MOTOR_MIX_m,MOTOR_CYCLE_m,MOTOR_MODE_m,MOTOR_CENTER_m;
UINT16 i=0xFFFF;
TBCR_TBIE =0; //Mask TBM interrupt
for(;i>0;i--){ //Wait for a time
__RESET_WATCHDOG();
}
EnableInterrupts;
if(Power == ON){
MOTOR_MIX_EN =0; //Motor stopped
MOTOR_CYCLE_EN =0;
MOTOR_MODE_EN =0;
MOTOR_CENTER_EN =0;
MOTOR_MIX_m =MOTOR_MIX; //Memory motor select state
MOTOR_CYCLE_m =MOTOR_CYCLE;
MOTOR_MODE_m =MOTOR_MODE;
MOTOR_CENTER_m =MOTOR_CENTER;
MOTOR_MIX =0;
MOTOR_CYCLE =0;
MOTOR_MODE =0;
MOTOR_CENTER =0;
fanladder_m =fanladder; //memory fanladder
fanladder =1; //Turn fan off
T1SC0_CH0MAX =0;
Fan_Down();
ADSCR_ADCH =0x1F; //ADC power off
COMPRESSOR =OFF; //Turn compressor off
//TBCR_TBIE =0; //Turn TBM interrupt off
SPSCK=0;
CS16512=1;
CS16512=0;
HoldTime();
DataOut(0x80); //Display off(keyscan continues)
HoldTime();
CS16512=1;
Power=OFF; //Set flag
INTKBSCR_IMASKK =1; //Mask keyboard interrupts
TBCR_TBON =0; //Timebase is disabled in order to spare power
__RESET_WATCHDOG(); //Kicks the dog
INTSCR_ACK = 1;
__asm STOP; //Enter stop mode
} else if(Power == OFF){
MOTOR_MIX =MOTOR_MIX_m; //Motor select state recovery
MOTOR_CYCLE =MOTOR_CYCLE_m;
MOTOR_MODE =MOTOR_MODE_m;
MOTOR_CENTER =MOTOR_CENTER_m;
fanladder =fanladder_m; //set fanladder in memory
Fan_Up(); //Turn fan on
SPSCK=0;
CS16512=1;
CS16512=0;//cs up
HoldTime();
DataOut(0x8F); //Display on(keyscan continues)
HoldTime();
CS16512=1;//cs down
Power=ON; //Set flag
INTKBSCR_IMASKK =0; //Mask keyboard interrupts
INTSCR_ACK = 1;
TBCR_TBON =1; //Timebase is enabled
TBCR_TBIE =1; //Turn TBM interrupt on
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -