#include <GLOBAL.h> #include <stdlib.h> #include <stdbool.h> #include <msp430x43x.h> #define BatPowerChkDirIn P1DIR &= ~BIT4 #define BatPowerChkIn P1IN & BIT4 #define BatPowerChk BIT4 #define MotoConOneOut P6DIR |= BIT1 #define MotoConOneHig P6OUT |= BIT1 #define MotoConOneLow P6OUT &=~ BIT1 #define MotoConTwoOut P6DIR |= BIT2 #define MotoConTwoHig P6OUT |= BIT2 #define MotoConTwoLow P6OUT &=~ BIT2 void PowerOnChk(void) { if(SecondsConn&0x20) { if(PowerLowTimer!=0) { PowerLowTimer--; } else { if(BatPowerChkIn)//---电池电源正常 { PowerLowFg=0; MeterSt[0]&=0xfb; } else { PowerLowFg=1; MeterSt[0]|=0x04; OpenLcd(); MotoStr(0);//--------------------------------------------------关阀 } PowerLowTimer=30; BatPowerChkDirIn; } SecondsConn&=0xdf; } }