/*编号功能模式0测试模式模式1大巷喷雾模式2触控喷雾模式3放炮喷雾模式4综采喷雾模式5测尘喷雾模式6遥控喷雾模式7设置菜单进入综采面系统界面*//*************************************************************************************************//*LCM19264C驱动阴码,逆向,行列,*//*************************************************************************************************//*球阀驱动*//*H1--------右开关、霍尔开关H2--------左开关、霍尔开关MOTO1-----电机正MOTO2-----电机负*//*************************************************************************************************/#includeSTC89C58RD+.h#includemath.h#includeintrins.h#includestdio.h//****************************************////液晶屏引脚定义//sbitCS1=P4^3;sbitCS2=P3^3;sbitCS3=P3^4;sbitRS=P0^2;sbitRW=P0^1;sbitEN=P0^0;sbitRST=P3^2;#defineDataPortP1#defineon1#defineoff0#definesave0x01//****************************************//sbitQF2=P2^5;sbitKM=P2^7;sbitY1=P2^6;sbitK4=P4^4;sbitY0=P2^4;sbitK3=P4^5;sbitK2=P4^1;sbitK1=P4^6;sbitQF1=P0^7;sbitHW1=P0^3;sbitHW2=P0^4;sbitHW3=P0^5;sbitHW4=P0^6;//****************************************//#defineucharunsignedchar#defineuintunsignedint#defineNOP_nop_()//****************************************//ucharmode,hour,minute,temp;uinttime,time_jian,tcnt;bittime_flag;bitwuxian;bitjishi,jishizhong;//*************************************************////voidtiansheng();voiddisplay_dashuzi(ucharxx,ucharyy,ucharn);voiddisplay_hanzi(ucharxx,ucharyy,ucharn,ucharfb);voiddisplay_xiaoshuzi(ucharxx,ucharyy,ucharn,ucharfb);voidtime_init();voidreset();voiddelay(longv);voidlcd_init(void);voiddison_off(ucharo);voidset_startline(uchari);voidset_xy(ucharx,uchary);voidlw(intx,uchary,uchardd);voidwcode(ucharc,ucharcsl,ucharcsr,ucharcs3);voidwdata(ucharc,ucharcsl,ucharcsr,ucharcs3);voiddisplay_shuzi(ucharxx,uchary,ucharn,ucharfb);voiddisplay_tiansheng_word(ucharxx,ucharyy,ucharn,ucharfb);voidzhujiemian();//ucharcodeqiang[];ucharcodedashuzi[];ucharcodehanzi[];ucharcodeshuzi[];/************************************************主程序*********************************************************/voidmain(void){time_init();//时钟初始化reset();//液晶屏复位lcd_init();//液晶屏初始化mode=4;time_jian=30;hour=15;minute=47;zhu:while(1){zhujiemian();if(HW4)gotoset;}set:while(1){if(HW3)gotozhu;}}voidzhujiemian(){switch(mode){case0:{display_hanzi(64,0,53,0);display_hanzi(80,0,54,0);display_hanzi(96,0,55,0);display_hanzi(112,0,56,0);}break;//测试模式case1:{display_hanzi(64,0,0,0);display_hanzi(80,0,1,0);display_hanzi(96,0,12,0);display_hanzi(112,0,13,0);if(K1|K2|Y0|Y1){QF1=QF2=1;TR0=1;jishizhong=1;time_jian=30;if(Y0|Y1)wuxian=1;}else{if(!jishizhong){QF1=QF2=0;time_jian=30;}else{}}}break;//大巷喷雾case2:{display_hanzi(64,0,2,0);display_hanzi(80,0,3,0);display_hanzi(96,0,12,0);display_hanzi(112,0,13,0);if(K1|Y0){QF1=QF2=0;TR0=1;jishizhong=1;time_jian=30;if(Y0|Y1)wuxian=1;}else{if(!jishizhong){QF1=QF2=1;time_jian=30;}else{}}}break;//触控喷雾case3:{display_hanzi(64,0,4,0);display_hanzi(80,0,5,0);display_hanzi(96,0,12,0);display_hanzi(112,0,13,0);if(K1&K2){QF1=QF2=0;TR0=1;jishizhong=1;time_jian=30;}else{if(!jishizhong){QF1=QF2=1;time_jian=30;}else{}}}break;//放炮喷雾case4:{display_hanzi(64,0,6,0);display_hanzi(80,0,7,0);display_hanzi(96,0,12,0);display_hanzi(112,0,13,0);if(K1|Y0|Y1){if(K1|Y0)QF1=0;if(Y1)QF2=0;TR0=1;jishizhong=1;time_jian=30;if(Y0|Y1)wuxian=1;}else{if(!jishizhong){QF1=QF2=1;time_jian=30;}else{}}}break;//综采喷雾case5:{display_hanzi(64,0,8,0);display_hanzi(80,0,9,0);display_hanzi(96,0,12,0);display_hanzi(112,0,13,0);if(K3){if(K1|K2|Y0|Y1){QF1=QF2=1;TR0=1;jishizhong=1;time_jian=30;if(Y0|Y1)wuxian=1;}else{if(!jishizhong){QF1=QF2=0;time_jian=30;}}}else{QF1=QF2=1;time_jian=30;TR0=0;jishizhong=0;wuxian=0;}}break;//测尘喷雾case6:{display_hanzi(64,0,10,0);display_hanzi(80,0,11,0);display_hanzi(96,0,12,0);display_hanzi(112,0,13,0);if(Y0|Y1){QF1=QF2=0;TR0=1;jishizhong=1;time_jian=30;if(Y0|Y1)wuxian=1;}else{if(!jishizhong){QF1=QF2=1;time_jian=30;}}}break;//遥控喷雾case7:{}break;//default:{}break;};display_hanzi(0,2,14,0);//信号display_hanzi(16,2,15,0);display_xiaoshuzi(32,2,10,0);switch(mode){case1:{display_hanzi(40,2,16,K1|Y0);//热释1display_hanzi(56,2,17,K1|Y0);display_xiaoshuzi(72,2,1,K1|Y0);display_hanzi(88,2,16,K2|Y1);//热释2display_hanzi(104,2,17,K2|Y1);display_xiaoshuzi(120,2,2,K2|Y1);}break;//大巷喷雾case2:{display_hanzi(40,2,2,K1|Y0);//触控display_hanzi(56,2,3,K1|Y0);}break;//大巷喷雾case3:{display_hanzi(40,2,2,K1);//触控display_hanzi(56,2,3,K1);display_hanzi(88,2,44,K2);//声控display_hanzi(104,2,3,K2);}break;//放炮喷雾case4:{display_hanzi(40,2,47,K1);//触控display_hanzi(56,2,48,K1);display_hanzi(88,2,45,Y1|Y0);//无线2display_hanzi(104,2,46,Y1|Y0);if(Y0|Y1){if(Y0)display_hanzi(120,2,49,Y0);if(Y1)display_hanzi(120,2,50,Y1);}elsedisplay_hanzi(120,2,43,Y1);}break;//综采喷雾case5:{display_hanzi(40,2,16,K1|K2|Y0|Y1);//热释1display_hanzi(56,2,17,K1|K2|Y0|Y1);if(K1&K2|Y0&Y1){display_xiaoshuzi(72,2,1,K1|Y0);display_xiaoshuzi(80,2,2,K2|Y1);}else{if(K1|Y0|K2|Y1){if(K1|Y0)display_xiaoshuzi(72,2,1,K1|Y0);elsedisplay_xiaoshuzi(72,2,2,K2|Y1);}else{display_xiaoshuzi(72,2,11,0);display_xiaoshuzi(80,2,11,0);}}display_hanzi(96,2,51,K3);//粉尘display_hanzi(112,2,52