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

📄 yibiao_ash.c

📁 这是我在我们公司做的C51加油单片机程序
💻 C
📖 第 1 页 / 共 5 页
字号:
        return 1;
}
void jezh1()
{
      union{
            unsigned long da;
            unsigned char aa[4];
        }idata jes;
        unsigned long xdata temp;
        unsigned char xdata i=0,g=0;
        huakuang(4,7,0);
        dog();
        jes.aa[0]=balance[0];
        jes.aa[1]=balance[1];
        jes.aa[2]=balance[2];
        jes.aa[3]=balance[3];
        temp=jes.da/1000000000;
        if (temp!=0)
        {
                xs_shu(4,3*8,yi_1+(temp*8));
                i++;
        }
        jes.da=jes.da-temp*1000000000;
        temp=jes.da/100000000;
        if ((temp!=0)||(i!=0))
        {
                xs_shu(4,4*8,yi_1+(temp*8));
                i++;
        }
        jes.da=jes.da-temp*100000000;
        temp=jes.da/10000000;
        if ((temp!=0)||(i!=0))
        {
                xs_shu(4,5*8,yi_1+(temp*8));
                i++;
        }
        jes.da=jes.da-temp*10000000;
        temp=jes.da/1000000;
        if ((temp!=0)||(i!=0))
        {
                xs_shu(4,6*8,yi_1+(temp*8));
                i++;
        }
        jes.da=jes.da-temp*1000000;
        temp=jes.da/100000;
        if ((temp!=0)||(i!=0))
        {
                xs_shu(4,7*8,yi_1+(temp*8));
                i++;
        }
        jes.da=jes.da-temp*100000;
        temp=jes.da/10000;
        if ((temp!=0)||(i!=0))
        {
                xs_shu(4,8*8,yi_1+(temp*8));
                i++;
        }
        jes.da=jes.da-temp*10000;
        temp=jes.da/1000;
        if ((temp!=0)||(i!=0))
        {
                xs_shu(4,9*8,yi_1+(temp*8));
                i++;
        }
        jes.da=jes.da-temp*1000;
        temp=jes.da/100;
        if ((temp!=0)||(i!=0))
        {
                xs_shu(4,10*8,yi_1+(temp*8));
                i++;
        }
        if (i==0)
        {
             g=1;
             xs_shu(4,10*8,yi_1);

        }
        xs_shu(4,11*8,yi_1+(11*8));
        i++;
        jes.da=jes.da-temp*100;
        temp=jes.da/10;
        if ((temp!=0)||(i!=0))
        {
                xs_shu(4,12*8,yi_1+(temp*8));
                i++;
        }
        temp=jes.da-temp*10;
        if ((temp!=0)||(i!=0))
        {
                xs_shu(4,13*8,yi_1+(temp*8));
                i++;
        }
        dog();
}
void xs_keybuf(unsigned char num)
{
        unsigned char i;
        for(i=0;i<num;i++)
        {
                if (keybuf[i]==0x0f)
                    xs_shu(4,112-(num-i)*8,yi_1+11*8);
                else
                    xs_shu(4,112-(num-i)*8,yi_1+keybuf[i]*8);
        }
}

void huakuang(unsigned char hang,unsigned char num,unsigned char lie_ge)
{
        unsigned char i,aa;

        for(i=lie_ge*16;i<num*16+lie_ge*16;i++)
        {
		if (i>63)
		{
			xscs2();
			write_control(0xb8+hang);
			write_control(0x40+i-64);
		}
		else
		{
			xscs1();
			write_control(0xb8+hang);
			write_control(0x40+i);
		}
		write_data(0x01);
        }
        for(i=lie_ge*16;i<num*16+lie_ge*16;i++)
        {
		if (i>63)
		{
			xscs2();
			write_control(0xb8+hang+1);
			write_control(0x40+i-64);
		}
		else
		{
			xscs1();
			write_control(0xb8+hang+1);
			write_control(0x40+i);
		}
		write_data(0x80);
        }

        if ((lie_ge*16)>63)
        {
                xscs2();
                write_control(0xb8+hang);
                write_control(0x40+lie_ge*16-64);
  	        write_data(0xff);
   	        write_control(0xb8+hang+1);
                write_control(0x40+lie_ge*16-64);
  	        write_data(0xff);
         }
        else
        {
                xscs1();
                write_control(0xb8+hang);
                write_control(0x40+lie_ge*16);
  	        write_data(0xff);
   	        write_control(0xb8+hang+1);
                write_control(0x40+lie_ge*16);
  	        write_data(0xff);
         }
        if ((num*16+lie_ge*16)>63)
        {
              if ((num*16+lie_ge*16)==128)
                 aa=65;
              else
                 aa=64;
              xscs2();
              write_control(0xb8+hang);
              write_control(0x40+num*16-aa+lie_ge*16);
  	      write_data(0xff);
              write_control(0xb8+hang+1);
              write_control(0x40+num*16-aa+lie_ge*16);
  	      write_data(0xff);
        }
        else
        {
              xscs1();
              write_control(0xb8+hang);
              write_control(0x40+num*16+lie_ge*16);
  	      write_data(0xff);
              write_control(0xb8+hang+1);
              write_control(0x40+num*16+lie_ge*16);
  	      write_data(0xff);
        }
}
void xs_shu(unsigned char hh,unsigned char ll,unsigned char *p)
{
	unsigned char idata i,temp,r;

        if (ll==121) ll=120;
        for(i=0;i<8;i++)
	{
                if ((ll+i)<64)
		{
                        xscs1();
			write_control(0xb8+hh);
                        dlu();
			write_control(0x40+ll+i);
                        dlu();
                }
		else
		{
			xscs2();
                        i=i;
			write_control(0xb8+hh);
			write_control(0x40+ll+i-64);
		}
                r=read_data();
                 if (r!=0xff)
                    r=r&0x01;
                if ((ll+i)<64)
		{
			xscs1();
			write_control(0xb8+hh);
                        dlu();
                        write_control(0x40+ll+i);
                        dlu();
		}
		else
		{
			xscs2();
			write_control(0xb8+hh);
			write_control(0x40+ll+i-64);
		}
                temp=*(p+i);
                temp<<=4;
                temp=temp+r;
		write_data(temp);
	}
        for(i=0;i<8;i++)
	{
                if ((ll+i)>63)
		{
			xscs2();
			write_control(0xb8+hh+1);
			write_control(0x40+ll+i-64);
		}
		else
		{
			xscs1();
			write_control(0xb8+hh+1);
			write_control(0x40+ll+i);
		}
                r=read_data();
                if (r!=0xff)
                    r=r&0x80;
                if ((ll+i)>63)
		{
			xscs2();
			write_control(0xb8+hh+1);
			write_control(0x40+ll+i-64);
		}
		else
		{
			xscs1();
			write_control(0xb8+hh+1);
			write_control(0x40+ll+i);
		}
                temp=*(p+i)>>4;
                temp=temp&0x0f;
                temp=temp+r;
                write_data(temp);
		//p++;
                dog();
       }
}
unsigned char read_data()
{
      unsigned t;
      RW=1;
      RS=1;
      t=E;
      dlu();
      return E;
}
void xs_time()
{
        unsigned char temp;
        static bit one=1;
        unsigned int tj2,tj;
        //if (!NET)
        if (P35==0)
        {
                pddc++;
                if ((dyjy==0)&&(pddc>200))
                {
                        clear();
                        xs_hhz(0,0,DYGD);
                        xs_hhz(2,0,BCJYJ);
                        dog();
                        //dey=send_jl(0,0xc1);
                        cut_power_save();
                        dog();
                        dey=send_jl(0,0xca);
                        xs_hhz(4,0,GDDC);
                        dog();
                        pddc=0;
                        while(1)
                        {

                                   if (P35==1)
                                      break;
                                   dog();
                        }
                  }
        }
        dog();
        yj_change();    /*实时监控油价修改*/
        main_comm();/*通讯主函数*/
        if ((NET)&&(COMM_CS==0)&&( XTLW_F==0))
        {
           NET=0;
        }
        if (yz_download_flag==1)
        {
           zhan_msg_change();
           yz_download_flag=0;
        }
        if (COMM_CS==3)
        {
          NET=1;
          xs_shu(6,2,yi_1+12*8);
        }
        gettime();
        /*年*/
        /*
        if((one==1)||(gn==1))
        {
                xs_shu(6,6+4,yi_1+8*2);
                xs_shu(6,12+4,yi_1+8*0);
        }
        if ((year!=year1)||(one==1)||(gn==1))
        {
                temp=year;
                xs_shu(6,24+4,clr);
                xs_shu(6,18+4,clr);
                xs_shu(6,24+4,yi_1+(temp&0x0f)*8);
                temp>>=4;
                xs_shu(6,18+4,yi_1+(temp&0x0f)*8);
        }


        if ((month1!=month)||(one==1)||(gn==1))
        {
                temp=month;
                xs_shu(6,42+4,clr);
                xs_shu(6,36+4,clr);
                xs_shu(6,42+4,yi_1+(temp&0x0f)*8);
                temp>>=4;
                xs_shu(6,36+4,yi_1+(temp&0x0f)*8);
        }

        if ((day1!=day)||(one==1)||(gn==1))
        {
                temp=day;
                xs_shu(6,60+4,clr);
                xs_shu(6,54+4,clr);
                xs_shu(6,60+4,yi_1+(temp&0x0f)*8);
                temp>>=4;
                xs_shu(6,54+4,yi_1+(temp&0x0f)*8);
        }

        if ((hour1!=hour)||(one==1)||(gn==1))
        {
                temp=hour;
                xs_shu(6,78+4,clr);
                xs_shu(6,72+4,clr);
                xs_shu(6,78+4,yi_1+(temp&0x0f)*8);
                temp>>=4;
                xs_shu(6,72+4,yi_1+(temp&0x0f)*8);
        }


        if ((one==1)||(gn==1))
        xs_shu(6,85+4,yi_1+10*8);

        if ((minutes1!=minutes)||(one==1)||(gn==1))
        {
                temp=minutes;
                xs_shu(6,96+4,clr);
                xs_shu(6,90+4,clr);
                xs_shu(6,96+4,yi_1+(temp&0x0f)*8);
                temp>>=4;
                xs_shu(6,90+4,yi_1+(temp&0x0f)*8);
        }

         if ((one==1)||(gn==1))
         xs_shu(6,103+4,yi_1+10*8);

        if ((second1!=second)||(one==1)||(gn==1))
        {
                temp=second;
                xs_shu(6,114+4,clr);
                xs_shu(6,108+4,clr);
                xs_shu(6,114+4,yi_1+(temp&0x0f)*8);
                temp>>=4;
                xs_shu(6,108+4,yi_1+(temp&0x0f)*8);
        }
           */

        tj2=trade_record_save;
        tj=tj2/1000;
        tj2=tj2-tj*1000;
        xs_shu(6,0,yi_1+tj*8);
        tj=tj2/100;
        tj2=tj2-tj*100;
        xs_shu(6,10,yi_1+tj*8);
        tj=tj2/10;
        tj2=tj2-tj*10;
        xs_shu(6,20,yi_1+tj*8);
        xs_shu(6,30,yi_1+tj2*8);


         tj2=trade_record_send;
        tj=tj2/1000;
        tj2=tj2-tj*1000;
        xs_shu(6,0+64,yi_1+tj*8);
        tj=tj2/100;
        

⌨️ 快捷键说明

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