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

📄 lcm16864zk.lst

📁 一个基于51单片机的报警系统。包含有电路图
💻 LST
📖 第 1 页 / 共 5 页
字号:
 634          
 635          //////////////////////////////////////////////////////////////////
 636          void RobSet(void)                                                 //防抢设置
 637          {
 638   1       WritCommand(0x01);                     //清零
 639   1       WritCommand(0x0c);
 640   1       WritCommand(0x92);
 641   1       WritData(0xb7);WritData(0xc0);WritData(0xc7);WritData(0xc0);    //防抢设置
 642   1       WritData(0xc9);WritData(0xe8);WritData(0xd6);WritData(0xc3);
 643   1       ShowPart5();                                                //显示  进入 另选
 644   1       while(1)
 645   1       {
 646   2       if(RKEY==0)
 647   2        {
 648   3        Delay_ms(10);
 649   3        if(RKEY==0)
 650   3         {
 651   4         while(1){if(RKEY==1) break; }
 652   4         }
 653   3         break;
 654   3        }
 655   2        if(LKEY==0)
 656   2        {
 657   3         Delay_ms(10);
 658   3         if(LKEY==0)
 659   3         {
 660   4         while(1) {if(LKEY==1)break;}
 661   4         RobData=0x00;                //报警处警向量初始化为00
 662   4         TeleAlarm();                 //报警处警设置     电话报警:Y
 663   4         WhistleAlarm();              //报警鸣笛:Y
 664   4         AlarmRelay();                //报警接力:Y
 665   4         BlankLocal();                //封锁现场:Y
 666   4         EjectFog();                  //喷射眠雾:Y
 667   4         pdx=0x0101;
 668   4         *pdx=RobData;
 669   4         AnlTime();         //设置与等待时间
 670   4         AnlNum();          //设置最少与数
 671   4         RobSetNext();      //设置向量
 672   4         break;
 673   4         }
 674   3        }
 675   2        ShowTime();
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 12  

 676   2       }
 677   1      }
 678          void RobSetNext(void)         //设置向量
 679          {
 680   1         uchar i;
 681   1         WritCommand(0x0e);
 682   1         i=EjectorNum();         //发射器编号
 683   1         EmployeeNum();          //员工编号
 684   1         AnlSet();               //逻辑关系
 685   1         RobSet1();              //继续 填写
 686   1      }
 687          void TeleAlarm(void)
 688          {
 689   1       bit i=1;
 690   1       WritCommand(0x01);
 691   1       WritCommand(0x0e);
 692   1       ShowPart3();              //电话报警:Y
 693   1       ShowPart4();               //显示 确认 选择
 694   1       while(1)
 695   1       {
 696   2        if(LKEY==0)
 697   2        {
 698   3         Delay_ms(10);
 699   3         if(LKEY==0)
 700   3         {
 701   4          while(1)
 702   4          {if(LKEY==1) break;}
 703   4          if(i==1)                        //如果选确认后 是Y ROBDATA的第一位为1
 704   4          {
 705   5           RobData=RobData|0x01;
 706   5           }
 707   4           else
 708   4           {                              //否则为0
 709   5           RobData=RobData&0xfe;
 710   5           }
 711   4         }
 712   3         break;
 713   3        }                                  //选择是Y  还是N
 714   2        if(RKEY==0)
 715   2        {
 716   3         Delay_ms(10);
 717   3         if(RKEY==0)
 718   3         {
 719   4          while(1)
 720   4           {if(RKEY==1) break;}
 721   4           i=~i;
 722   4           if(i==1)
 723   4           {
 724   5           WritCommand(0x95);
 725   5           WritData(0xa3);WritData(0xd9);
 726   5           WritCommand(0x10);
 727   5            }
 728   4            else
 729   4            {
 730   5             WritCommand(0x95);
 731   5             WritData(0xa3);WritData(0xce);
 732   5             WritCommand(0x10);
 733   5            }
 734   4          }
 735   3        }
 736   2        WritCommand(0x95);
 737   2       }
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 13  

 738   1      }
 739          
 740          void WhistleAlarm(void)                    //鸣警笛设置
 741          {
 742   1       bit i=1;
 743   1       WritCommand(0x01);
 744   1       ShowPart6();                     //鸣警笛 :Y
 745   1       ShowPart4();
 746   1       while(1)
 747   1       {
 748   2        if(LKEY==0)
 749   2        {
 750   3         Delay_ms(10);
 751   3         if(LKEY==0)
 752   3         {
 753   4          while(1)
 754   4          {if(LKEY==1) break;}
 755   4          if(i==1)                          //确认后如果是Y 则ROBDATA的第二位为1
 756   4          {
 757   5           RobData=RobData|0x02;
 758   5           }                                //否则为0
 759   4           else
 760   4           {
 761   5            RobData=RobData&0xfd;
 762   5           }
 763   4      
 764   4         }
 765   3         break;
 766   3        }                                    //选择是Y或N
 767   2        if(RKEY==0)
 768   2        {
 769   3         Delay_ms(10);
 770   3         if(RKEY==0)
 771   3         {
 772   4          while(1)
 773   4           {if(RKEY==1) break;}
 774   4          WritCommand(0x95);
 775   4           i=~i;
 776   4           if(i==1)
 777   4           {
 778   5           WritCommand(0x95);
 779   5           WritData(0xa3);WritData(0xd9);
 780   5           WritCommand(0x10);
 781   5            }
 782   4            else
 783   4            {
 784   5             WritCommand(0x95);
 785   5             WritData(0xa3);WritData(0xce);
 786   5             WritCommand(0x10);
 787   5            }
 788   4          }
 789   3         }
 790   2         WritCommand(0x95);
 791   2       }
 792   1      }
 793                                           //设置接力报警
 794          void AlarmRelay(void)
 795          {
 796   1       bit i=1;
 797   1       WritCommand(0x01);
 798   1       ShowPart7();                   //接力报警:Y
 799   1       ShowPart4();
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 14  

 800   1       while(1)
 801   1       {
 802   2        if(LKEY==0)
 803   2        {
 804   3         Delay_ms(10);
 805   3         if(LKEY==0)
 806   3         {                                       //确认后是Y 则第三位为1
 807   4          while(1)
 808   4          {if(LKEY==1) break;}
 809   4          if(i==1)
 810   4          {
 811   5           RobData=RobData|0x04;
 812   5           }                                      //否则为0
 813   4           else
 814   4           {
 815   5            RobData=RobData&0xfb;
 816   5           }
 817   4      
 818   4          }
 819   3         break;
 820   3         }                                         //选择是Y或是N
 821   2        if(RKEY==0)
 822   2        {
 823   3         Delay_ms(10);
 824   3         if(RKEY==0)
 825   3         {
 826   4          while(1)
 827   4           {if(RKEY==1) break;}
 828   4          WritCommand(0x95);
 829   4           i=~i;
 830   4           if(i==1)
 831   4           {
 832   5           WritCommand(0x95);
 833   5           WritData(0xa3);WritData(0xd9);
 834   5           WritCommand(0x10);
 835   5            }
 836   4            else
 837   4            {
 838   5             WritCommand(0x95);
 839   5             WritData(0xa3);WritData(0xce);
 840   5             WritCommand(0x10);
 841   5            }
 842   4         }
 843   3        }
 844   2        WritCommand(0x95);
 845   2       }
 846   1      
 847   1      }
 848          
 849          
 850          void BlankLocal(void)
 851          {
 852   1       bit i=1;
 853   1       WritCommand(0x01);
 854   1       ShowPart8();                                          //封锁现场:Y
 855   1       ShowPart4();
 856   1       while(1)
 857   1       {                                                 //如果选确认后 是Y ROBDATA的第4位为1
 858   2        if(LKEY==0)
 859   2        {
 860   3         Delay_ms(10);
 861   3         if(LKEY==0)
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 15  

 862   3         {
 863   4          while(1)
 864   4          {if(LKEY==1) break;}
 865   4          if(i==1)
 866   4          {
 867   5           RobData=RobData|0x08;
 868   5           }
 869   4           else                                      //否则为0
 870   4           {
 871   5            RobData=RobData&0xf7;
 872   5           }
 873   4      
 874   4         }
 875   3         break;
 876   3        }
 877   2        if(RKEY==0)
 878   2        {                                             //选择是Y或是N
 879   3         Delay_ms(10);
 880   3         if(RKEY==0)
 881   3         {
 882   4          while(1)
 883   4           {if(RKEY==1) break;}
 884   4          WritCommand(0x95);
 885   4           i=~i;
 886   4           if(i==1)
 887   4           {
 888   5           WritCommand(0x95);
 889   5           WritData(0xa3);WritData(0xd9);
 890   5           WritCommand(0x10);
 891   5            }
 892   4            else
 893   4            {
 894   5             WritCommand(0x95);
 895   5             WritData(0xa3);WritData(0xce);
 896   5             WritCommand(0x10);
 897   5            }
 898   4         }
 899   3         WritCommand(0x95);
 900   3        }
 901   2       }
 902   1      
 903   1      }
 904          void EjectFog(void)
 905          {
 906   1        bit i=1;
 907   1       WritCommand(0x01);
 908   1       ShowPart9();                                          //喷射眠雾:Y
 909   1       ShowPart4();
 910   1       while(1)
 911   1       {
 912   2        if(LKEY==0)
 913   2        {
 914   3         Delay_ms(10);
 915   3         if(LKEY==0)
 916   3         {
 917   4          while(1)                                        //第五位是否为1 或 0
 918   4          {if(LKEY==1) break;}
 919   4          if(i==1)
 920   4          {
 921   5           RobData=RobData|0x10;
 922   5           }
 923   4           else
C51 COMPILER V7.06   LCM16864ZK                                                            12/21/2006 15:22:27 PAGE 16  

 924   4           {
 925   5            RobData=RobData&0xef;
 926   5           }
 927   4      
 928   4         }
 929   3         break;
 930   3        }
 931   2        if(RKEY==0)
 932   2        {
 933   3         Delay_ms(10);
 934   3         if(RKEY==0)
 935   3         {
 936   4          while(1)
 937   4           {if(RKEY==1) break;}
 938   4           WritCommand(0x95);
 939   4           i=~i;
 940   4           if(i==1)
 941   4           {
 942   5           WritCommand(0x95);
 943   5           WritData(0xa3);WritData(0xd9);
 944   5           WritCommand(0x10);
 945   5            }
 946   4            else
 947   4            {
 948   5             WritCommand(0x95);
 949   5             WritData(0xa3);WritData(0xce);
 950   5             WritCommand(0x10);
 951   5            }
 952   4           }
 953   3         }
 954   2         WritCommand(0x95);

⌨️ 快捷键说明

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