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

📄 yibiao.c.bak

📁 这是我在我们公司做的C51加油单片机程序
💻 BAK
📖 第 1 页 / 共 5 页
字号:
            disp_suf[i]=buf;
            dlu();
        }
        ZK_CS=1;
        dlu();
        dlu();
        dlu();
        xscs1();
	for(i=0;i<16;i++)
	{
		if ((ll+i)>63)
		{
			xscs2();
			write_control(0xb8+hh);
			write_control(0x40+ll+i-64);
		}
		else
		{
			xscs1();
			write_control(0xb8+hh);
			write_control(0x40+ll+i);
		}
		write_data(disp_suf[i]);
		//p++;
	}

	for(i=0;i<16;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);
		}
		write_data(disp_suf[i+16]);
	//	p++;
	}


}
void xscs1()
{
        CS1=1;
        CS2=0;
}
void xscs2()
{
        CS1=0;
        CS2=1;
}



void xs_hhz(unsigned char hh,unsigned char ll, unsigned int *p)
{
        unsigned char i;
        for(i=0;*(p+i)!=0;i++)
                if (*(p+i)!=0xffff)
                   xs_zi(hh,ll+i*16,*(p+i));
}
void astobcd(unsigned char n)
{
      char l,temp;
      if (n==1) return;
      for(l=keybuf_p;l<6;l++)
      keybuf[l]=0x00;
      for(l=0;l<n;l+=2)
      {
            temp=keybuf[l]<<4;
            temp=temp|keybuf[l+1];
            keybuf[l/2]=temp;
      }
}
bit strcomp(unsigned char *p1,unsigned char *p2,unsigned char num)
{
        unsigned char i;
        for(i=0;i<num;i++)
        {
                if ((*(p1+i))!=(*(p2+i)))
                   return 0;
        }
        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);
        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++;
        }
}
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++;
	}
}
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;

        //if (!NET)
        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);

⌨️ 快捷键说明

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