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

📄 lcm16864zk.lst

📁 一个基于51单片机的报警系统。包含有电路图
💻 LST
📖 第 1 页 / 共 5 页
字号:
1371   2              Delay_ms(10);
1372   2           }
1373   1         k=CodeN[0]*16+CodeN[1];
1374   1         k=0x20+k;
1375   1         return k;
1376   1      }
1377          
1378           //////////////////////////////////////////////////////////////////////////////
1379           /////////////////////////////////////////////////////////////////放火设置
1380          void FireSet(void)
1381          {
1382   1       uchar j;
1383   1      
1384   1       WritCommand(0x01);                     //清零
1385   1       WritCommand(0x0c);
1386   1       WritCommand(0x92);
1387   1       WritData(0xb7);WritData(0xc0);WritData(0xbB);WritData(0xF0);   //防火设置
1388   1       WritData(0xc9);WritData(0xe8);WritData(0xd6);WritData(0xc3);
1389   1        ShowPart5();
1390   1       while(1)
1391   1       {
1392   2        if(RKEY==0)
1393   2        {
1394   3         while(1){if(RKEY==1) break; }
1395   3        // CalenSet();
1396   3         break;
1397   3        }
1398   2        if(LKEY==0)
1399   2        {
1400   3         while(1) {if(LKEY==1)break;}
1401   3         RobData=0x00;
1402   3         WritCommand(0x0e);
1403   3         TeleAlarm();
1404   3         WhistleAlarm();
1405   3         AlarmRelay();
1406   3         EjectWater();
1407   3         EjectSand();
1408   3         pdx=0x0301;
1409   3         *pdx=RobData;
1410   3         j=EjectorNum();
1411   3      
1412   3         FireSet1(j);
1413   3         break;
1414   3         }
1415   2         Delay_ms(10);
1416   2         ShowTime();
1417   2        }
1418   1      }
C51 COMPILER V7.06   LCM16864ZK                                                            11/15/2006 18:43:11 PAGE 24  

1419          
1420          void EjectWater(void)
1421          {
1422   1       bit i=1;
1423   1       WritCommand(0x01);
1424   1       ShowPart15();                                          //自动喷水:Y
1425   1       ShowPart4();
1426   1       while(1)
1427   1       {
1428   2        if(LKEY==0)
1429   2        {
1430   3         Delay_ms(10);
1431   3         if(LKEY==0)
1432   3         {
1433   4          while(1)
1434   4          {if(LKEY==1) break;}
1435   4          if(i==1)
1436   4          {
1437   5           RobData=RobData|0x08;
1438   5           }
1439   4           else
1440   4           {
1441   5            RobData=RobData&0xf7;
1442   5           }
1443   4      
1444   4         }
1445   3         break;
1446   3        }
1447   2        if(RKEY==0)
1448   2        {
1449   3         Delay_ms(10);
1450   3         if(RKEY==0)
1451   3         {
1452   4          while(1)
1453   4           {if(RKEY==1) break;}
1454   4          WritCommand(0x95);
1455   4           i=~i;
1456   4           if(i==1)
1457   4           {
1458   5           WritCommand(0x95);
1459   5           WritData(0xa3);WritData(0xd9);
1460   5           WritCommand(0x10);
1461   5            }
1462   4            else
1463   4            {
1464   5             WritCommand(0x95);
1465   5             WritData(0xa3);WritData(0xce);
1466   5             WritCommand(0x10);
1467   5            }
1468   4         }
1469   3         WritCommand(0x95);
1470   3        }
1471   2       }
1472   1      }
1473          void EjectSand(void)
1474          {
1475   1        bit i=1;
1476   1       WritCommand(0x01);
1477   1       ShowPart16();                                          //自动喷沙:Y
1478   1       ShowPart4();
1479   1       while(1)
1480   1       {
C51 COMPILER V7.06   LCM16864ZK                                                            11/15/2006 18:43:11 PAGE 25  

1481   2        if(LKEY==0)
1482   2        {
1483   3         Delay_ms(10);
1484   3         if(LKEY==0)
1485   3         {
1486   4          while(1)
1487   4          {if(LKEY==1) break;}
1488   4          if(i==1)
1489   4          {
1490   5           RobData=RobData|0x10;
1491   5           }
1492   4           else
1493   4           {
1494   5            RobData=RobData&0xef;
1495   5           }
1496   4      
1497   4         }
1498   3         break;
1499   3        }
1500   2        if(RKEY==0)
1501   2        {
1502   3         Delay_ms(10);
1503   3         if(RKEY==0)
1504   3         {
1505   4          while(1)
1506   4           {if(RKEY==1) break;}
1507   4           WritCommand(0x95);
1508   4           i=~i;
1509   4           if(i==1)
1510   4           {
1511   5           WritCommand(0x95);
1512   5           WritData(0xa3);WritData(0xd9);
1513   5           WritCommand(0x10);
1514   5            }
1515   4            else
1516   4            {
1517   5             WritCommand(0x95);
1518   5             WritData(0xa3);WritData(0xce);
1519   5             WritCommand(0x10);
1520   5            }
1521   4           }
1522   3         }
1523   2         WritCommand(0x95);
1524   2        }
1525   1      
1526   1      }
1527          
1528          void FireSet1(uchar num)
1529          {
1530   1       uchar i,j;
1531   1       WritCommand(0x0c);
1532   1       ShowPart14();
1533   1       while(1)
1534   1         {
1535   2           if(LKEY==0)
1536   2             {
1537   3              Delay_ms(10);
1538   3              if(LKEY==0)
1539   3               {
1540   4                  pdx=0x0300;
1541   4                  i=*pdx;
1542   4                  *pdx=i+1;
C51 COMPILER V7.06   LCM16864ZK                                                            11/15/2006 18:43:11 PAGE 26  

1543   4                   pdx=0x0302+i+1;
1544   4                   *pdx=num;
1545   4                  while(1)
1546   4                  {
1547   5                  if(LKEY==1) break;
1548   5                  }
1549   4                  break;
1550   4                }
1551   3              }
1552   2              if(MKEY==0)
1553   2             {
1554   3              Delay_ms(10);
1555   3              if(MKEY==0)
1556   3               {
1557   4                  WritCommand(0x0e);
1558   4                  FireSet();
1559   4      
1560   4                  while(1)
1561   4                  {
1562   5                  if(LKEY==1) break;
1563   5                  }
1564   4                  break;
1565   4                }
1566   3              }
1567   2            if(RKEY==0)
1568   2                    {
1569   3                      Delay_ms(10);          //延时去抖动
1570   3                      if(RKEY==0)
1571   3                      {
1572   4                        pdx=0x0300;
1573   4                        i=*pdx;
1574   4                        *pdx=i+1;
1575   4                        j=EjectorNum();
1576   4                        FireSet1(j);
1577   4                       }
1578   3                     }
1579   2              ShowTime();
1580   2              Delay_ms(10);
1581   2           }
1582   1      }
1583          
1584          void CalenSet(void)
1585          {
1586   1       uchar i;
1587   1       WritCommand(0x01);                     //清零
1588   1       WritCommand(0x0c);
1589   1       ShowPart17();
1590   1       ShowPart5();
1591   1       ShowTime();
1592   1       while(1)
1593   1       {
1594   2        if(RKEY==0)
1595   2        {
1596   3         while(1){if(RKEY==1) break; }
1597   3      
1598   3         break;
1599   3        }
1600   2        if(LKEY==0)
1601   2        {
1602   3         while(1) {if(LKEY==1)break;}
1603   3      
1604   3         CalenSet1();
C51 COMPILER V7.06   LCM16864ZK                                                            11/15/2006 18:43:11 PAGE 27  

1605   3         WritData(0x2f);
1606   3      
1607   3         CalenSet2();
1608   3          WritData(0x2f);
1609   3      
1610   3         CalenSet3();
1611   3          WritData(0x2f);
1612   3      
1613   3          CalenSet4();
1614   3          WritData(0x2f);
1615   3      
1616   3          i=CalenSet5();
1617   3         calen[1]=i;
1618   3         i=CalenSet5();
1619   3         calen[0]=i;
1620   3         BurstW1302(calen);
1621   3         ///////////////////////////////////////////
1622   3         break;
1623   3         }
1624   2        }
1625   1      }
1626          void CalenSet1(void)
1627          {
1628   1       uchar k=0;
1629   1       WritCommand(0x98);
1630   1       WritData(0xc8);WritData(0xb7);          //确认
1631   1       WritData(0xc8);WritData(0xcf);
1632   1       WritCommand(0x9b);
1633   1       WritData(0xc9);WritData(0xcf);WritData(0xb7);WritData(0xad);     //上翻
1634   1       WritCommand(0x9e);
1635   1       WritData(0xcf);WritData(0xc2);WritData(0xb7);WritData(0xad);     //下翻
1636   1       WritCommand(0x80);
1637   1       WritData(0x20);WritData(0x20);
1638   1       Delay_ms(150);
1639   1       WritCommand(0x10);
1640   1       ShowK(k);
1641   1       while(1)
1642   1       {
1643   2      
1644   2         if(LKEY==0)
1645   2         {
1646   3          Delay_ms(10);
1647   3          if(LKEY==0)
1648   3          {
1649   4           while(1){if(LKEY==1)break;}                  //年
1650   4           calen[6]=k;
1651   4           }
1652   3           break;
1653   3          }
1654   2          if(MKEY==0)
1655   2          {
1656   3           Delay_ms(10);
1657   3           if(MKEY==0)
1658   3            {
1659   4             while(1){if(MKEY==1)break;}
1660   4             if(k==0x99)
1661   4             {
1662   5              k=0x00;
1663   5              }
1664   4             else if((k&0x0f)==9)
1665   4             {
1666   5              k=k&0xf0;
C51 COMPILER V7.06   LCM16864ZK                                                            11/15/2006 18:43:11 PAGE 28  

1667   5              k=k+0x10;
1668   5             }
1669   4             else {k++;}
1670   4             WritCommand(0x10);
1671   4             ShowK(k);
1672   4             }
1673   3            }
1674   2           if(RKEY==0)
1675   2           {
1676   3            Delay_ms(10);
1677   3            if(RKEY==0)
1678   3            {
1679   4             while(1){if(RKEY==1)break;}
1680   4             if(k==0x00)
1681   4             {
1682   5              k=0x99;
1683   5              }
1684   4             else if((k&0x0f)==0)
1685   4             {
1686   5              k=k-0x10;
1687   5              k=k+0x09;
1688   5             }
1689   4             else {k--;}
1690   4              WritCommand(0x10);
1691   4             ShowK(k);
1692   4            }
1693   3           }
1694   2      
1695   2       }
1696   1      }
1697          void CalenSet2(void)
1698          {
1699   1       uchar k=0;
1700   1       WritData(0x20);WritData(0x20);
1701   1       Delay_ms(150);
1702   1       WritCommand(0x10);
1703   1       ShowK(k);
1704   1      // uchar i;
1705   1       while(1)
1706   1       {
1707   2      
1708   2         if(LKEY==0)
1709   2         {
1710   3          Delay_ms(10);
1711   3          if(LKEY==0)
1712   3          

⌨️ 快捷键说明

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