使用430制作的水表---低压检测

[复制链接]
1830|0
 楼主| 雁舞白沙 发表于 2012-2-28 09:25 | 显示全部楼层 |阅读模式
#i nclude <GLOBAL.h>
#i nclude <stdlib.h>
#i nclude <stdbool.h>
#i nclude <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;
    }
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

213

主题

789

帖子

242

粉丝
快速回复 在线客服 返回列表 返回顶部