打印

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

[复制链接]
874|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

帖子

243

粉丝