当前位置:   article > 正文

c语言智能家居源码,智能家居控制系统C程序

智能家居控制系统c语言代码

智能家居控制系统C程序

来源:--

作者:--

浏览:786

时间:2016-08-10 14:18

标签:

摘要:

#include  bit r_flag; enum  eepromtype  {M2401,M2402,M2404,M2408,M2416,M2432,M2464,M24128,M24256}; extern bit   RW24XX(unsigned

#include  bit r_flag; enum  eepromtype  {M2401,M2402,M2404,M2408,M2416,M2432,M2464,M24128,M24256};

extern bit   RW24XX(unsigned char *DataBuff,unsigned char ByteQuantity,unsigned int Address,

unsigned char ControlByte,enum eepromtype EepromType);

sbit key   = P2^0;

bit key_flag; sbit dog   = P0^7;

sbit LED   = P0^0;

sbit TELA   = P3^6;

sbit TEL  = P3^7;

sbit RING  = P3^2;

sbit switching =P0^4;

unsigned char mode;

bit passwordflag;

unsigned char password[6];

unsigned char passwordtest[6]; void dlms(unsigned int x);

void reset(void);

void open(void); //****************************************************************  //

//               INT1中断服务程序                                   //

//****************************************************************  //

unsigned char ring_fluctuation;

unsigned char ring_count;

bit ring_flag;

void servICe_int0() interrupt 0 using 1

{

if(ring_fluctuation<10)

{

ring_fluctuation++;

}

}

//****************************************************************  //

//                      t1 定时中断                                   //

//****************************************************************  //

unsigned char ring_dlsm;

unsigned char ring_time;

unsigned int ring_reset_time;

unsigned char dlms_time;

void timer1 (void) interrupt 3 using 0

{

TH1=0x3c;

TL1=0xb0;

dlms_time++;

if(ring_fluctuation>5)

{

EX0=0;//INT1_OFF;

ring_dlsm++;

if(ring_dlsm==20)//等待一秒

{

ring_dlsm=0;

EX0=1;//INT1_ON;

ring_fluctuation=0;

ring_count++;//震铃次数          if(ring_flag)//有效振铃

{

if(ring_count==6)

{

ring_count=7;

mode=1;

}

}

else//无效振铃

{

if(ring_count>2)

{

ring_reset_time=800;

}

}

}

}

if((ring_count==2)|(ring_count==1))

{

ring_time++;

if(ring_time==200)

{

ring_flag=1;

}

}

if((ring_count>0)&(ring_count<6))

{

LED=INT0;

}

else if(passwordflag)

{

LED=~LED;

}

if(ring_count>0)

{

ring_reset_time++;

if(ring_reset_time==1100)//55s

{

reset();

LED=0;

dlms(100);

LED=1;

dlms(100);

LED=0;

dlms(100);

LED=1;

dlms(100);

LED=0;

dlms(100);

LED=1;

dlms(100);

LED=0;

dlms(100);

LED=1;

dlms(100);

LED=0;

dlms(100);

LED=1;

dlms(100);

LED=0;

dlms(100);

LED=

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/893534
推荐阅读
  

闽ICP备14008679号