⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcm16864zk.lst

📁 一个基于51单片机的报警系统。包含有电路图
💻 LST
📖 第 1 页 / 共 5 页
字号:
1276   3         while(1){if(RKEY==1) break; }
1277   3      
1278   3         break;
1279   3        }
1280   2        if(LKEY==0)
1281   2        {
1282   3         while(1) {if(LKEY==1)break;}
1283   3         RobData=0x00;                   //报警向量设为00
1284   3         TeleAlarm();             //电话报警:Y
1285   3         WhistleAlarm();          //鸣警笛:Y
1286   3         AlarmRelay();            //报警接力:Y
1287   3         BlankLocal();            //封锁现场:Y
1288   3         EjectFog();              //喷射眠雾:Y
1289   3         pdx=0x0201;
1290   3         *pdx=RobData;
1291   3         j=EjectorNum();          //发射器编号设置
1292   3         StealSet1(j);
1293   3         break;
1294   3         }
1295   2         Delay_ms(10);
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 22  

1296   2         ShowTime();
1297   2        }
1298   1       }
1299          
1300          void StealSet1(uchar num)
1301          {
1302   1       uchar i,j;
1303   1       WritCommand(0x0c);                                  //填写  不填  继续
1304   1       ShowPart14();
1305   1       while(1)
1306   1         {
1307   2           if(LKEY==0)
1308   2             {
1309   3              Delay_ms(10);
1310   3              if(LKEY==0)
1311   3               {
1312   4                  pdx=0x0200;
1313   4                  i=*pdx;
1314   4                  *pdx=i+1;
1315   4                  pdx=0x0202+i+1;
1316   4                  *pdx=num;
1317   4      
1318   4                  while(1)
1319   4                  {
1320   5                  if(LKEY==1) break;
1321   5                  }
1322   4                  break;
1323   4                }
1324   3              }
1325   2              if(MKEY==0)
1326   2             {
1327   3              Delay_ms(10);
1328   3              if(MKEY==0)
1329   3               {
1330   4      
1331   4           StealSet();
1332   4      
1333   4                  while(1)
1334   4                  {
1335   5                  if(LKEY==1) break;
1336   5                  }
1337   4                  break;
1338   4                }
1339   3              }
1340   2            if(RKEY==0)
1341   2                    {
1342   3                      Delay_ms(10);          //延时去抖动
1343   3                      if(RKEY==0)
1344   3                      {
1345   4                     /*   pdx=0x0200;
1346   4                        i=*pdx;
1347   4                        *pdx=i+1;      */
1348   4                        j=EjectorNum();
1349   4                        StealSet1(j);
1350   4                       }
1351   3                     }
1352   2              ShowTime();
1353   2              Delay_ms(10);
1354   2           }
1355   1       }
1356          
1357          
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 23  

1358          uchar EjectorNum(void)                          //返回编号的值
1359          {
1360   1       uchar k=0,j=0;
1361   1       uchar CodeN[2]={0,0};;
1362   1       WritCommand(0x01);
1363   1       WritCommand(0x0e);
1364   1       ShowPart2();                                   //发射器编号:00
1365   1       ShowPart1();
1366   1       while(k<2)
1367   1           {
1368   2      
1369   2           if(LKEY==0)
1370   2             {
1371   3              Delay_ms(10);
1372   3              if(LKEY==0)
1373   3               {
1374   4                CodeN[k]=j;
1375   4                  while(1)
1376   4                  {
1377   5                  if(LKEY==1) break;
1378   5                  }
1379   4                  k++;
1380   4                }
1381   3              }
1382   2           if(MKEY==0)
1383   2                    {
1384   3                       Delay_ms(5);
1385   3                       if(MKEY==0)
1386   3                        {
1387   4                          j++;
1388   4                          if(j>9) j=0;
1389   4                          WritData(0xa3);
1390   4                          WritData(0xb0+j);         //显示下个数
1391   4                          WritCommand(0x10);
1392   4                          while(1)
1393   4                          {
1394   5                          if(MKEY==1) break;
1395   5                          }
1396   4                        }
1397   3                      }
1398   2            if(RKEY==0)
1399   2                    {
1400   3                      Delay_ms(10);          //延时去抖动
1401   3                      if(RKEY==0)
1402   3                      {
1403   4                          CodeN[k]=j;
1404   4                          WritCommand(0x14);
1405   4                          k++;
1406   4                          if(k>=2)
1407   4                          {k=0;WritCommand(0x96);}
1408   4                          WritData(0xa3);
1409   4                          WritData(0xb0);
1410   4                          WritCommand(0x10);
1411   4                          j=0;
1412   4                          while(1)
1413   4                           {
1414   5                            if(RKEY==1) break;
1415   5                           }
1416   4                        }
1417   3                       }
1418   2              ShowTime();
1419   2              WritCommand(0x96+k);
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 24  

1420   2              Delay_ms(10);
1421   2           }
1422   1         k=CodeN[0]*16+CodeN[1];
1423   1         k=0x20+k;
1424   1         return k;
1425   1      }
1426          
1427           //////////////////////////////////////////////////////////////////////////////
1428           /////////////////////////////////////////////////////////////////放火设置
1429          void FireSet(void)
1430          {
1431   1      // uchar j;
1432   1      
1433   1       WritCommand(0x01);                     //清零
1434   1       WritCommand(0x0c);
1435   1       WritCommand(0x92);
1436   1       WritData(0xb7);WritData(0xc0);WritData(0xbB);WritData(0xF0);   //防火设置
1437   1       WritData(0xc9);WritData(0xe8);WritData(0xd6);WritData(0xc3);
1438   1        ShowPart5();
1439   1       while(1)
1440   1       {
1441   2        if(RKEY==0)
1442   2        {
1443   3         while(1){if(RKEY==1) break; }
1444   3        // CalenSet();
1445   3         break;
1446   3        }
1447   2        if(LKEY==0)
1448   2        {
1449   3         while(1) {if(LKEY==1)break;}
1450   3         RobData=0x00;                    //报警向量初始化为00
1451   3         WritCommand(0x0e);
1452   3         TeleAlarm();                     //电话报警:Y
1453   3         WhistleAlarm();                  //鸣警笛:Y
1454   3         AlarmRelay();                    //报警接力:Y
1455   3         EjectWater();                    //喷洒水:Y
1456   3         EjectSand();                     //自动喷沙:Y
1457   3         pdx=0x0301;
1458   3         *pdx=RobData;
1459   3       //  j=EjectorNum();
1460   3         FireSet1();
1461   3         break;
1462   3         }
1463   2         Delay_ms(10);
1464   2         ShowTime();
1465   2        }
1466   1      }
1467          
1468          void EjectWater(void)
1469          {
1470   1       bit i=1;
1471   1       WritCommand(0x01);
1472   1       ShowPart15();                                          //自动喷水:Y
1473   1       ShowPart4();
1474   1       while(1)
1475   1       {
1476   2        if(LKEY==0)
1477   2        {
1478   3         Delay_ms(10);
1479   3         if(LKEY==0)
1480   3         {
1481   4          while(1)
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 25  

1482   4          {if(LKEY==1) break;}
1483   4          if(i==1)
1484   4          {
1485   5           RobData=RobData|0x08;
1486   5           }
1487   4           else
1488   4           {
1489   5            RobData=RobData&0xf7;
1490   5           }
1491   4      
1492   4         }
1493   3         break;
1494   3        }
1495   2        if(RKEY==0)
1496   2        {
1497   3         Delay_ms(10);
1498   3         if(RKEY==0)
1499   3         {
1500   4          while(1)
1501   4           {if(RKEY==1) break;}
1502   4          WritCommand(0x95);
1503   4           i=~i;
1504   4           if(i==1)
1505   4           {
1506   5           WritCommand(0x95);
1507   5           WritData(0xa3);WritData(0xd9);
1508   5           WritCommand(0x10);
1509   5            }
1510   4            else
1511   4            {
1512   5             WritCommand(0x95);
1513   5             WritData(0xa3);WritData(0xce);
1514   5             WritCommand(0x10);
1515   5            }
1516   4         }
1517   3         WritCommand(0x95);
1518   3        }
1519   2       }
1520   1      }
1521          void EjectSand(void)
1522          {
1523   1        bit i=1;
1524   1       WritCommand(0x01);
1525   1       ShowPart16();                                          //自动喷沙:Y
1526   1       ShowPart4();
1527   1       while(1)
1528   1       {
1529   2        if(LKEY==0)
1530   2        {
1531   3         Delay_ms(10);
1532   3         if(LKEY==0)
1533   3         {
1534   4          while(1)
1535   4          {if(LKEY==1) break;}
1536   4          if(i==1)
1537   4          {
1538   5           RobData=RobData|0x10;
1539   5           }
1540   4           else
1541   4           {
1542   5            RobData=RobData&0xef;
1543   5           }
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 26  

1544   4      
1545   4         }
1546   3         break;
1547   3        }
1548   2        if(RKEY==0)
1549   2        {
1550   3         Delay_ms(10);
1551   3         if(RKEY==0)
1552   3         {
1553   4          while(1)
1554   4           {if(RKEY==1) break;}
1555   4           WritCommand(0x95);
1556   4           i=~i;
1557   4           if(i==1)
1558   4           {
1559   5           WritCommand(0x95);
1560   5           WritData(0xa3);WritData(0xd9);
1561   5           WritCommand(0x10);
1562   5            }
1563   4            else
1564   4            {
1565   5             WritCommand(0x95);
1566   5             WritData(0xa3);WritData(0xce);
1567   5             WritCommand(0x10);
1568   5            }
1569   4           }
1570   3         }
1571   2         WritCommand(0x95);
1572   2        }
1573   1      
1574   1      }
1575          
1576          void FireSet1()
1577          {
1578   1       uchar i,j;
1579   1       j=EjectorNum();
1580   1       WritCommand(0x0c);                 //填写   不填   继续
1581   1       ShowPart14();
1582   1       while(1)
1583   1         {
1584   2           if(LKEY==0)
1585   2             {
1586   3              Delay_ms(10);
1587   3              if(LKEY==0)
1588   3               {
1589   4                  pdx=0x0300;
1590   4                  i=*pdx;
1591   4                  *pdx=i+1;
1592   4                  pdx=0x0302+i+1;
1593   4                  *pdx=j;
1594   4                  while(1)
1595   4                  {
1596   5                  if(LKEY==1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -