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

📄 yibiao.c.bak

📁 这是我在我们公司做的C51加油单片机程序
💻 BAK
📖 第 1 页 / 共 5 页
字号:
                                        clear();
                                        xs_hhz(0,24,JYWC);
                                        xs_hhz(4,0,ARYJJX);
                                        key=0xff;
                                        /*员工卡加油操作完成*/
                                        while(key==0xff)
                                        {
                                                key=getkey();
                                                xs_time();
                                        }
                                        goto j9;
                                     }
                                }
                        }
                        if (key=='t')
                        {
                                ck_flag=0;
                                out_card();
                                goto j3;
                        }
                        xs_time();
                   }
j30:
                   i=menu_1();
                   if (i==0x0f)
                       goto j3;/*如果按返回键*/
                   else
                       if (!ygkjycz(i))/*员工卡支付类型操作*/
                       {
                            // out_card();
                             goto j9;/*如果按返回键*/
                       }
                   clear();
                   xs_hhz(0,24,JYWC);
                   xs_hhz(4,0,ARYJJX);
                   key=0xff;
                   /*员工卡加油操作完成*/
                   while(key==0xff)
                   {
                        key=getkey();
                        xs_time();
                   }
                   goto j9;
               }
               /*员工卡处理完毕*/
               if (use_pse_inf[12]==0x01)/*插入的是用户卡处理*/
               {
                   clear();
                   pd=0;
                   yhmm[0]=use_001b_file[2];
                   yhmm[1]=use_001b_file[3];
                   //xs_hhz(0,0,SRYHMM);
j6:
                   if (use_001b_file[0]==0)
                   {
                        card_err_state=ver_pin1();
                        if (card_err_state!=0)
                        {
                                kybc();
                                goto j3;
                        }
                   }
                   else
                   {
                        xs_hhz(0,0,SRYHKMM);
                        for(i=0;i<3;i++)
                        {
                            key=pass_card();
                            if (key==2)
                            {
                                 ck_flag=0;
                                 out_card();
                                 goto j3;/*卡以锁主,请解锁*/
                            }
                            card_err_state=ver_pin();
                            if (card_err_state==0)
                                break;
                            else
                            {
                                clear();
                                xs_hhz(0,0,MMCWQCS);
                            }
                         }
                         if (card_err_state!=0)
                         {
                                    clear();
                                    xs_hhz(0,0,CHDS1);
                                    xs_hhz(2,0,CHDS2);
                                    key=0xff;
                                    while(1)
                                    {
                                        key=getkey();
                                        if (key!=0xff)
                                        {
                                                ck_flag=0;
                                                out_card();/*弹卡*/
                                                goto j3;
                                        }
                                           xs_time();
                                    }
                         }
                   }
                   if (card_err_state==0)
                   {
                       clear();
                       xs_hhz(0,0,ZAXZHMD);/*查找黑名单*/
                       xs_hhz(2,0,QSD);
                       search_hb=1;
                       search_result=2;
                       if (!NET)
                          while(1)
                          {
                                key=getkey();
                                if (key=='l')
                                {
                                        ck_flag=0;
                                        out_card();
                                        goto j3;
                                }
                                xs_time();
                                if (search_result==0)
                                {
                                        clear();
                                        xs_hhz(0,0,CKSHK);
                                        xs_hhz(4,0,QTK);
                                        while(1)
                                        {
                                                key=getkey();
                                                if (key=='t')
                                                {
                                                        ck_flag=0;
                                                        out_card();
                                                        goto j3;
                                                 }
                                                 xs_time();
                                         }
                                 }
                                 if (search_result==1)
                                         break;
                             }
                             else
                             {
                                nlist[0]=use_pse_inf[10];
                                nlist[1]=use_pse_inf[11];
                                nlist[2]=use_pse_inf[12];
                                nlist[3]=use_pse_inf[13];
                                nlist[4]=use_pse_inf[14];
                                nlist[5]=use_pse_inf[15];
                                nlist[6]=use_pse_inf[16];
                                nlist[7]=use_pse_inf[17];
                                nlist[8]=use_pse_inf[18];
                                nlist[9]=use_pse_inf[19];
                                tidyCpoy(2);
                                copy(2);
                                i=seeAbout(2);
                                if (i==1) goto hkcz;
                                tidyCpoy(3);
                                copy(3);
                                i=seeAbout(3);
                                if (i==1) goto tjck;
                                tidyCpoy(1);
                                copy(1);
                                i=seeAbout(1);
                                if (i==0) goto tjck;
                                if (i==1)
                                {
hkcz:
                                        clear();
                                        xs_hhz(0,0,CKSHK);
                                        xs_hhz(4,0,QTK);
                                        while(1)
                                        {
                                                key=getkey();
                                                if (key=='t')
                                                {
                                                        ck_flag=0;
                                                        out_card();
                                                        goto j3;
                                                 }
                                                 xs_time();
                                         }
                                 }

                             }
                        /**/
tjck:
                       if (ash_card())
                          goto j3;
                       ck_flag=1;/*插卡*/
                       clear();
                       if (yhkjycz())
                       {
                             xs_hhz(0,24,JYWC);
                             ck_flag=0;
                             out_card();
                             ck_flag=0;
                             goto j3;
                       }
                       else
                          goto j3;
                  }
               }
        }
        if (key=='x')/*处理加油机下班*/
        {
j5:
              clear();
              xs_hhz(2,32,XB);
              while(1)
              {
                      key=getkey();
                      if (key=='l')
                         goto j2;
                      if (key=='k')
                         break;
              }
              clear();
              xs_hhz(0,0,QSRYGMM);
              i=password(0);
              if (i==2)/*返回退卡*/
              {
                   ck_flag=0;
                   out_card();
                   goto j3;
              }
              if (i==1) /*密码正确*/
              {
                   ck_flag=0;
                   out_card();
                   XBR=1;
                   trade_record(6);
                   goto start;
              }
              if (i==0)/*密码错误*/
              {
                   ck_flag=0;
                   out_card();
                   goto j3;
              }
        }
        if  (key=='.')
        {
                while(1)
                {
                        key=getkey();
                        if (key!=0xff)
                        if (key=='k')
                           goto j5;
                        else
                           goto j4;
                }
        }
        xs_time();
   }


}
/*主程序结束*/
unsigned int dw_zk(unsigned int qw)
{
        union
        {
                unsigned int int_z;
                unsigned char ch_z[2];
         } xdata zk;
         union
        {
                unsigned long int_z1;
                unsigned int ch_z1[2];
         } xdata zk1;
        unsigned long w1;

        zk.int_z=qw;
        w1=94*(zk.ch_z[0]-0xa1)+(zk.ch_z[1]-0xa1);
        zk1.int_z1=w1*32;
        zk.int_z=zk1.ch_z1[0];
        ZK_CS=1;
        XBYTE[0xc011]=zk.ch_z[1];
        return  zk1.ch_z1[1];
     }

void write_control(unsigned char con)
{
        RW=0;
        RS=0;
        E=con;
}
void write_data(unsigned char d)
{
        RW=0;
        RS=1;
     	E=d;
}

void init_xs()
{
	unsigned char page;
       de30ms();
       de30ms();
       de30ms();
       de30ms();
       de30ms();
       de30ms();
       xscs1();
        write_control(0x3f);
        write_control(0xc0);
       xscs2();
        write_control(0x3f);
        write_control(0xc0);

        for(page=0;page<8;page++)
	{
		clr_hang(page);
	}

}
void clear()
{
	unsigned char page;

	for(page=0;page<6;page++)
	{
		clr_hang(page);
	}

}
unsigned char getkey()
{
	unsigned char temp,i=0;
        static bit keyf=1;
        key_dlu();
        key_dlu();
        //ES=0;
        for(i=0;i<21;i++)
	{
                if (i==0)
                   KEY_SDA=0;
                else
                    KEY_SDA=1;
                KEY_CLK=1;
		dlu();
		KEY_CLK=0;
		dlu();

                temp=XBYTE[0xc010];
                temp=temp&0x01;
                if (temp==0)
                {
                         // comm_status=0;
                         // ES=1;
                           if (keyf==1)
                            switch (i)
                           {
                                case 1:{keyf=0;sound();return 8;}
                                case 2:{keyf=0;sound();return 7;}
                                case 3:{keyf=0;sound();return 6;}
                                case 4:{keyf=0;sound();return 5;}
                                case 5:{keyf=0;sound();return 4;}
                                case 6:{keyf=0;sound();return 3;}
                                case 7:{keyf=0;sound();return 2;}
                                case 8:{keyf=0;sound();return 1;}
                                case 9:{keyf=0;sound();return 'k';}
                                case 10:{keyf=0;sound();return 'l';}
                                case 11:{keyf=0;sound();return '.';}
                                case 12:{keyf=0;sound();return 0;}
                                case 13:{keyf=0;sound();return 'j';}
                                case 14:{keyf=0;sound();return 'g';}
                                case 15:{keyf=0;sound();return 'e';}
                                case 16:{keyf=0;sound();return 9;}
                                case 17:{keyf=0;sound();return 't';}
                                case 18:{keyf=0;sound();return 'x';}
                                case 19:{keyf=0;sound();return 's';}
                           }
                           else
                             return 0xff;
                }
	}
       keyf=1;
       //comm_status=0;
       //ES=1;
       return 0xff;
}
void clr_hang(unsigned char hang)
{
	unsigned char lie;

        xscs1();
	write_control(0xb8+hang);
	for(lie=0;lie<64;lie++)
	{
		write_control(0x40+lie);
		write_data(0);
	}
        xscs2();
        write_control(0xb8+hang);
	for(lie=0;lie<64;lie++)
	{
		write_control(0x40+lie);
		write_data(0);
	}

}
void xs_zi(unsigned char hh,unsigned char ll,unsigned int p)
{
	unsigned char idata i;
        unsigned char idata buf;
        unsigned int idata temp;
        unsigned char idata disp_suf[32];
        temp=dw_zk(p);
        for(i=0;i<32;i++)
        {
            ZK_CS=0;
            //zk_save=0;
           // dlu();
            buf=XBYTE[temp+i];
            //dlu();
            ZK_CS=1;
           // zk_save=1;

⌨️ 快捷键说明

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