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

📄 initial.h

📁 能实现4种洗衣程序选择 标准洗衣 经济洗衣 单独洗衣 单独脱水 选择 高低水位 强弱洗 是否开启浸泡功能 还有脱水程序选择 3、5分间歇脱水 3、5分长脱水四种
💻 H
字号:
#include <STC89C51.h>
#include <intrins.h>


sbit  a0=P2^5;
sbit  a1=P2^6;
sbit  a2=P2^7;

sbit DAT=P2^1;
sbit CLK=P2^0;
sbit send=P2^4;

sbit  feng=P3^6;
sbit  stop=P3^0;

sbit  key4=P1^0;
sbit  key3=P1^1;
sbit  key5=P1^4;
sbit  key6=P1^5;

sbit  zhengz=P1^2;
sbit  fanz  =P1^3;
sbit  jinsf  =P1^6;
sbit  paisf  =P1^7;

sbit  gaos=P3^1;
sbit  zant=P3^2;
sbit  kaig=P3^3;
sbit  dis=P3^4;
sbit  pianx=P3^5;
sbit  pais=P3^7;


void init(void);
void delay_s(unsigned char timedata);
void delay_ms(unsigned char timedata);
void WX_SM(unsigned char c,unsigned char b,unsigned char a);
void key_saomiao(void);
void key_que(void);
void key_han(void);
void alarm(void);
void led(void);
void xiuzheng(void);
void sendbyte(unsigned int num);
void xy_jinshui(void);
void xy_xidi(void);
void tuoshui_jianxie(void);
						   

unsigned char code led_code[10]={0x03,0x9f,0x25,0x0d,0x99,0x49,0x41,0x1f,0x01,0x09};
unsigned char code xy_select[5]={0xfe,0xfd,0xfb,0xf7,0xff};
unsigned int code tab[]={0xfffe,0xfffd,0xfffb,0xfff7,0xffef,0xffdf,0xffbf,0xff7f,0xfeff,0xfdff,0xfbff,0xf7ff,0xefff,0xdfff,0xbfff,0x7fff,0xffff};
//------音频编码表------------- 1---1#---2----2#---3----4----4#---5----5#---6----6#---7----------------
					  /*休止符--1---2----3----4----5----6----7----8----9----10---11---12-*/
unsigned char code TH[]={     0xf1,0xf1,0xf2,0xf3,0xf4,0xf4,0xf5,0xf6,0xf6,0xf7,0xf7,0xf8,  //--低音
	/*--高八位--*/		      0xf8,0xf8,0xf9,0xf9,0xfa,0xfa,0xfa,0xfb,0xfb,0xfb,0xfb,0xfc,  //--中音
						      0xfc,0xfc,0xfc,0xfc,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfe,  //--高音
						      0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe
                        };
unsigned char code TL[]={     0x17,0xf3,0xb7,0x7b,0x2a,0xd7,0x71,0x08,0x9c,0x2a,0xa7,0x20,  //--低音
   /*--低八位--*/             0x8c,0xf9,0x5b,0xbd,0x15,0x6b,0xbc,0x07,0x4e,0x92,0xd1,0x0e,  //--中音
						      0x48,0x7d,0xaf,0xde,0x0c,0x36,0x5e,0x84,0xa8,0xc9,0xe9,0x07,  //--高音
						      0x23,0x3e,0x58,0x6f,0x86,0x9b,0xaf,0xc2,0xd4,0xe5,0xf4
                        };
//----节拍码---------------1/8,1/4,1/2,3/4,7/8,1,3/2,2, 3, 4,  5, 6, 7, 8,16---------------
unsigned char code Beat[]={ 1,  2,  4,  6,  7, 8, 12,16,24,32,40,48,56,64,128};
						 /*-0---1---2---3---4--5---6--7--8--9-10-11-12-13-14-*/
//--音调编码表-------------C--C#--D--D#--00E--F--F#--G--G#--A--A#--B------------------------------
unsigned char code tone[]={-1,0,  1, 2,  3, 4, 5,  6, 7,  8, 9, 10};						   
 

bit s1_biao=0,s2_biao=0,s3_biao=0,s4_biao=0;	  //各键初值
bit dsd=0;	   //定时时间到的标志
bit flag=0;	   //进、排水完成标志
bit gj=0;	    //关机时间标志
						 
signed char   j=5;			//单独脱水时间
unsigned char  cout=0;				//键扫描值
unsigned char sw=0;					//单独脱水时间的十位
unsigned char  gw=0;				   // 单独脱水时间的个位
unsigned char  s=0;				   //修正次数
unsigned char  errcode=0;			   //错误代码
unsigned char  n=0;				   //洗涤次数
unsigned char  p=0;
unsigned char BTH0,BTL0;
unsigned char time2,timedata;
unsigned char x=0,y=0;
unsigned char q;
unsigned char key_flag;
unsigned char KeyState=0;
				  
				   
unsigned int  idata ss=0;
unsigned int  time0=0,time1=0;
unsigned int  num,senddata,lastdata;	   //发送的数据
				  

signed char  i=0;					  //洗涤程序
signed char  m1=2,m0=0,s1=0,s0=0;		//设定20分钟初值
signed char  k=4;	   //k 高低水位
signed char  qr=6;		 //洗涤强弱标志
signed char  pao=8;//浸泡标志  
signed char   m=9;				//脱水方式选择

⌨️ 快捷键说明

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