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

📄 6-2.txt

📁 单片机应用开发实例.rar
💻 TXT
📖 第 1 页 / 共 5 页
字号:
        test(117)=h12/10+30h;
        test(118)=(h12-h12/10*10)+30h;
        test(129)=h13/10+30h;
        test(130)=(h13-h13/10*10)+30h;
        test(141)=h14/10+30h;
        test(142)=(h14-h14/10*10)+30h;
        test(145)=year3+30h;
        test(146)=year4+30h;
        test(148)=moun1+30h;
        test(149)=moun2+30h;
        test(151)=day1+30h;
        test(152)=day2+30h;
        test(155)=hour/10+30h;
        test(156)=(hour-hour/10*10)+30h;
        test(158)=min/10+30h;
        test(159)=(min-min/10*10)+30h;
        prnumb=162;
        call print;
     end;
     else 
     do;
     w79=83h;
     w79d=0ffh;
     end;
     enable;
end n1;
                                     /*    看模拟量    */  
n2: procedure;
    w79=83h;
    w79d=0h;
    w79=84h;
    w79d=0h;
    lokmerg=55h;
    lokmer1g=55h;
    thirdg=55h;
    fcung=0h;
    f11=0h;
    f12=0h;
end n2;
                                        /*     屏蔽     */
n3: procedure;
    w79=83h;
    w79d=0h;
    w79=84h;
    w79d=0h;
    shiledg=55h;
    sl1g=55h;
    thirdg=55h;
    fcung=0h;
    f11=0h;
    f12=0h;
end n3;
                                              /*   看屏   */
n4: procedure;
    ;
    w79=83h;
    w79d=0h;
    w79=84h;
    w79d=0h;
    thirdg=55h;
    fcung=0h;
    f11=0h;
    f12=0h;
    ;
    pwm=0h;
    ;
    vv=0;
    do while vv<>55h; 
       vv=tor(ping).pb;
       if vv=55h then
       do;
          w79=84h;
          w79d=dec(tor(ping).flor);
          w79=83h;
          w79d=dec(tor(ping).numb);
       end; 
       if upp=1 then ping=ping-1;
       else ping=ping+1;
       if vv=0 and ping=101 and ping=0 then vv=8h; 
       if ping=0 then ping=100h;
       if ping=101h then ping=1h;
    end;
    vv=0;
    lockn4=1;
end n4;   
                                          /*    消屏     */
n5: procedure;
    disslg=55h;
    dissl1g=55h;
    w79=84h;
    w79d=0h;
    w79=83h;
    w79d=0h;
    ;
    thirdg=55h;
    fcung=0h;
    f11=0h;
    f12=0h;
end n5;
                                            /*   看编码单元    */
n6: procedure;
    pwm=0ffh;
    w79=83h;
    w79d=0h;
    w79=84h;
    w79d=0h;
    thirdg=55h;
    fcung=0h;
    f11=0h;
    f12=0h;
    do ll=1h to 100h;
       if tor(ll).ten=55h then
       do;
          w79=84h;
          w79d=tor(ll).flor;
          w79=83h;
          w79d=dec(tor(ll).numb);
          call time(2000);
       end;
       vv=0h;
    end;
end n6;
                                                 /*    小复位   */
n7: procedure;
    zsd88=zsd88 or 4h;
    w79=88h;
    w79d=zsd88;
    zsd89=zsd89 and 62h;
    w79=89h;
    w79d=zsd89;
    zsd87=zsd87 or 80h;
    w79=87h;
    w79d=zsd87;

    w79=83h;
    w79d=0ffh;
    w79=84h;
    w79d=0ffh;
    w79=81h;
    w79d=0ffh;
    fire=0h;
    error=0h;
    ping=0h;
    do j=0 to 256;
       tor(j).acunt=0;
       tor(j).fir=0;
       tor(j).err=0;
       tor(j).mer=0;
       tor(j).ready=0;
       tor(j).shi=0;
       tor(j).fen=0;
    end;
    fcung=0h;
    f11=0h;
    f12=0h;
end n7;
                                                /*    调时     */
n8: procedure;
    if fire=0h and error=0h then
    do;
       w79=83h;
       w79d=0h;
       w79=84h;
       w79d=0h;
       timg=55h;
       tim1g=55h;
       thirdg=55h;
       fcung=0h;
       f11=0h;
       f12=0h;
    end;
end n8;
                                           /*     调日期     */
n9: procedure; 
    w79=81h;
    w79d=0h;
    w79=83h;
    w79d=0h;
    w79=84h;
    w79d=0h;
    thirdg=55h;
    datag=55h;
    year1g=55h;
    fcung=0h;
    f11=0h;
    f12=0h;
end n9;
                                              /*    总线复位   */
n10: procedure;
     fcung=0h;
     f11=0h;
     f12=0h;
     w79=83h;
     w79d=0ffh;
     zsd88=zsd88 or 4h;
     w79=88h;
     w79d=zsd88;
     zsd87=zsd87 or 82h;
     w79=87h;
     w79d=zsd87;
     errzx=0;
     error=error-1;
     if error=0h then
     do;
        zsd89=zsd89 and 7fh;
        w79=89h;
        w79d=zsd89;
        if fire=0 then 
        do;
        pt8255=pt8255 and 0e6h;
        w79=83h;
        w79d=0ffh;
        end;
        else pt8255=pt8255 and 0f7h;
        ptd=80h;
        ;
        ptc=pt8255;
     end;
     else
     do;
        if fire=0 then pt8255=pt8255 and 0f6h;
        else pt8255=pt8255 and 0f7h;
        ptd=80h;
        ;
        ptc=pt8255;
     end;
     fcung=0h;
     f11=0h;
     f12=0h;
end n10;
                                                /*     回车      */
ent: procedure;
     if thirdg=55h then 
     do; 
        if (timg=55h and tim1g=0h) then      
        do; 
           timg=0h;
           thirdg=0h;
           min=tim4;
           hour=tim2;
           w79=83h;
           w79d=0ffh;
           w79=84h;
           w79d=0ffh;
           w79=85h;
           w79d=tim4;
           w79=86h;
           w79d=tim2;
        end;
        else
        do;
           if shiledg=55h then 
           do;
              sl4g=0h;
              thirdg=0h; 
              shiledg=0h;
              if sl2=1 then
              do;
              tor(sl4).pb=55h;
              pingbi=pingbi+1;
              end;
              if sl2=2 then
              do;
              tor(sl4+40h).pb=55h;
              pingbi=pingbi+1;
              end;
              if sl2=3 then
              do;
              tor(sl4+80h).pb=55h;
              pingbi=pingbi+1;
              end;
              if sl2=4 then
              do;
              tor(sl4+0c0h).pb=55h;
              pingbi=pingbi+1;
              end;
              w79=83h;
              w79d=0ffh;
              w79=84h;
              w79d=0ffh;
              if pingbi=1 then
              do;
                zsd87=zsd87 and 0efh;
                w79=87h;
                w79d=zsd87;
                end;
           end;
           else 
           do;
              if lokslg=55h then
              do;
                 lokslg=0h;
                 f1=55h;
              end;
              else 
              do;
                 if disslg=55h then 
                 do;
                    disslg=0h;
                    dissl4g=0h;
                    if dissl2=1 then
                    do;
                    tor(dissl4).pb=0h;
                    pingbi=pingbi-1;
                    end;
                    if dissl2=2 then
                    do;
                    tor(dissl4+40h).pb=0h;
                    pingbi=pingbi-1;
                    end;
                    if dissl2=3 then
                    do;
                    tor(dissl4+80h).pb=0h;
                    pingbi=pingbi-1;
                    end;
                    if dissl2=4 then
                    do;
                    tor(dissl4+0c0h).pb=0h;
                    pingbi=pingbi-1;
                    end;
                    w79=83h;
                    w79d=0ffh;
                    w79=84h;
                    w79d=0ffh;
                    if pingbi=0 then
                       do;
                       zsd87=zsd87 or 10h;
                       w79=87h;
                       w79d=zsd87;
                     end;
                 end;
                 else 
                 do;
                    if lokerrg=55h then 
                    do;
                       lokerrg=0h;
                       f2=55h;
                    end;
                    else 
                    do;
                       if lokadrg=55h then lokadrg=0h;
                       else 
                       do;
                          if lokmerg =55h then
                          do;
                             lokmerg=0h;
                             if lokmer2=1h then 
                             do;
                                w79=81h;
                                w79d=dec(tor(lokmer4).mer); 
                             end;
                             if lokmer2=2h then 
                             do;
                                w79=81h;
                                w79d=dec(tor(lokmer4+40h).mer); 
                             end;
                             if lokmer2=3h then 
                             do;
                                w79=81h;
                                w79d=dec(tor(lokmer4+80h).mer); 
                             end;
                             if lokadr2=4h then 
                             do;
                                w79=81h;
                                w79d=dec(tor(lokmer4+0c0h).mer); 
                             end;
                          end;
                          else 
                          do;
                             if datag=55h then 
                             do;
                                datag=0h;
                                w79=81h;
                                w79d=0ffh;
                                w79=83h;
                                w79d=0ffh;
                                w79=84h;
                                w79d=0ffh;
                             end;
                          end;
                       end;
                    end;
                 end;
              end;
           end;
        end;             
     end;
     if fcung=55h then   
     do; 
        if f11=5h and f12=1h then call n1;
        if f11=5h and f12=2h then call n2;
        if f11=5h and f12=3h then call n3;
        if f11=5h and f12=4h then call n4;   
        if f11=5h and f12=5h then call n5;
        if f11=5h and f12=6h then call n6;
        if f11=5h and f12=7h then call n7;
        if f11=5h and f12=8h then call n8;
        if f11=5h and f12=9h then call n9;
        if f11=6h and f12=1h then call n10;
     end;
     if numg=55h then
     do;
        if num1=7h and num2=4h and num3=7h then
        do;
           numg=0h;
           num1=0h;
           num2=0h;
           num3=0h;
           fcung=55h;
           f11g=55h;
           w79=83h;
           w79d=0h;
           w79=82h;
           w79d=0ffh;
        end;
     end;
end ent;

err1: procedure;
      do ii=1 to 3;
         portd=80h;
         ;
         portb=0ffh-i; 
         ;
         portc=10h;
         ;
         latter=0h;
         latt=timer1;
         ;
         do while latter <1ff0h;
            ;
            ;
            latter=timer1-latt;
         end;
         ;
         portd=80h;
         ;
         portc=1fh;     
         call time(2800);
         toa(ii).mer=(high1-low1)/500;
         high1=0h;
         low1=0h;
      end;
      if toa(1).mer>estep then toa(1).ave=1;
      if toa(2).mer>estep then toa(2).ave=1;
      if toa(3).mer>estep then toa(3).ave=1;
      if (toa(1).ave+toa(2).ave+toa(3).ave)<1 then tor(i).err=55h;
      do ii=1 to 8;
         null=hsi_time;
      end;
end err1;

err2: procedure; 
      do ii=1 to 3;
         portd=80h;
         ;
         portb=0ffh-i; 
         ;
         portc=10h;
         ;
         latter=0h;
         latt=timer1;
         ;
         do while latter <1ff0h;
            ;
            ;
            latter=timer1-latt;
         end;
         ;
         portd=80h;
         ;
         portc=1fh;     
         call time(2800);
         tob(ii).mer=(high2-low2)/500;       
         high2=0h;
         low2=0h;
      end;
      if tob(1).mer>estep then tob(1).ave=1;
      if tob(2).mer>estep then tob(2).ave=1;
      if tob(3).mer>estep then tob(3).ave=1;
      if (tob(1).ave+tob(2).ave+tob(3).ave)<1 then tor(i+64).err=55h;
      do ii=1 to 8;
         null=hsi_time;
      end;

end err2;

err3: procedure; 
      do ii=1 to 3;
         portd=80h;
         ;
         portb=0ffh-i; 
         ;
         portc=10h;
         ;
         latter=0h;
         latt=timer1;
         ;
         do while latter <1ff0h;
            ;
            ;
            latter=timer1-latt;
         end;
         ;
         portd=80h;
         ;
         portc=1fh;     
         call time(2800);
         toc(ii).mer=(high3-low3)/500;       
         high3=0h;

⌨️ 快捷键说明

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