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

📄 main_soft_run.c

📁 单片机工业控制板,具备I/O,KEYBOARD,步进电机伺服电机等功能
💻 C
📖 第 1 页 / 共 4 页
字号:
	
				else if(y_postion_staus==3)
				{
					array(y_postion,1000);
					y_postion_staus=4;
					}
	
				else if(z_postion_staus==3)
				{
					array_num(z_postion,100);
					z_postion_staus=4;
	
				}
	
	
	
	
	
	
	
			}
	
	
			else if (xx_photo==4)
			{
				if(TAB==3)
				{
					if(instruction==0)
					{
						wr_lcd(comm,0x0F);
						TAB=0;
						ADDR=1;
						instruction=0x94;
						}
					else if(instruction==0x94)
					{
						wr_lcd(comm,0x0F);	
						TAB=0;
						ADDR=2;
						instruction=0X8C;
						}
				}
	
	
	
			 	if(EXCHANGE==3)
				{
					wr_lcd(comm,0x06);
					EXCHANGE=4;
				}
	
				else if(EXCHANGE==18)
				{
					chn_disp11(tab11);
	//					j=5;
	//				wr_lcd(dat,chn8[j]);
					EXCHANGE=19;
				}
	
				else if(EXCHANGE==33)
				{
					
					j=4;
					number(j);
					EXCHANGE=34;
				}
				else if(EXCHANGE==48)
				{
					j=8;
					number(j);
					
					EXCHANGE=49;
				}
	
				else if(z_up_speed_staus==3)
				{
					array(z_up_speed,1000);
					z_up_speed_staus=4;
					}
				else if(z_down_speed_staus==3)
				{
					array(z_down_speed,1000);
					z_down_speed_staus=4;
	
				}
	
	
	
			}		


		}






		Cont.bits.R_INPUT2=0;

	}		
	if(Cont.bits.R_INPUT2_MANAGE==1)
	{

//		DelayUmSec(5);
		Back_xx_photo=xx_photo;//back xx_photo
		KR8=in_buffer&0X01;
		KR9=in_buffer&0X02;
		KR10=in_buffer&0X04;
		KR11=in_buffer&0X08;
		KR12=in_buffer&0X10;
		KR13=in_buffer&0X20;
		KR14=in_buffer&0X40;
		//***********************************
		chk_busy();

		if(!BUSY)
		{

			if(KR_input==4)
			{	//j=1;
				if(!KR0)chn_disp15(tab15);	//x left limit
				else if(!KR1)chn_disp16(tab16);	// x right limit 
				else if(!KR2)chn_disp17(tab17);	//z up limit
				else if(!KR4)chn_disp13(tab13);	//y first limit
				else if(!KR5)chn_disp14(tab14);	//y back limit

				KR_input=5;
			}

		}

		//************************************************





		chk_busy();
		if(!BUSY)
		{
			if(xx_photo==1)					//exchange photo
			{
			 	if(EXCHANGE==4)
				{
					wr_lcd(comm,0x0F);
					EXCHANGE=5;
				}
	
				else if(EXCHANGE==19)
				{
					chn_disp2(tab2);
	//					j=4;
	//					wr_lcd(dat,chn2[j]);
					EXCHANGE=20;
				
				}
				else if(EXCHANGE==34)
				{
						
					j=3;
					number(j);
					EXCHANGE=35;
				
				}
	
				else if(EXCHANGE==49)
				{
					wr_lcd(comm,0x0C);
					EXCHANGE=50;
				
				}
	
				//************************************************************
				else if(LCD_jingei_staus==4)//lcd refresh
				{
					j=1;
					number(j);
					LCD_jingei_staus=5;
					}
				else if(y_distance_staus==4)		//y_distance_refresh
				{
					j=1;
					number(j);
					
					y_distance_staus=5;

					}
	
				else if(y_totallength_staus==4)		//y_totallength_refresh
				{
	
					j=1;
					number(j);
					y_totallength_staus=5;
					}
	
			}
	
	
			else if(xx_photo==2)
			{
	
			 	if(EXCHANGE==4)
				{
					wr_lcd(comm,0x0F);
					EXCHANGE=5;
				}
				else if(EXCHANGE==19)
				{
					wr_lcd(comm,0x30);
	
					EXCHANGE=20;
				}
				else if(EXCHANGE==34)
				{	
					wr_lcd(comm,0x30);
					EXCHANGE=35;
				}
	
				else if(guangmo_times_staus==4)
				{
					j=1;
					number(j);
					guangmo_times_staus=5;
					}
				else if(z_waitpostion_staus==4)
				{
					j=1;
					number(j);
					z_waitpostion_staus=5;
					}
	
	
	
	
			}
	
			else if(xx_photo==3)
			{
	
			 	if(EXCHANGE==4)
				{
					wr_lcd(comm,0x0F);
					EXCHANGE=5;
				}
				else if(EXCHANGE==19)
				{
					chn_disp9(tab9);
	//					j=0;
	//					wr_lcd(dat,chn9[j]);
	
					EXCHANGE=20;
				}
	
				else if(EXCHANGE==34)
				{
					j=2;
					number(j);
					EXCHANGE=35;
				}
	
				else if(y_postion_staus==4)
				{
					j=1;
					number(j);
					y_postion_staus=5;
					}
	
	
				else if(z_postion_staus==4)
				{
					j=1;
					number(j);
					z_postion_staus=5;
	
					}
	
			}
	
			else if(xx_photo==4)
			{
	
			 	if(EXCHANGE==4)
				{
					wr_lcd(comm,0x0F);
					EXCHANGE=5;
				}
	
	
				else if(EXCHANGE==19)
				{
					wr_lcd(comm,0x30);
					
					EXCHANGE=20;
				}
	
				else if(EXCHANGE==34)
				{
					
					j=5;
					number(j);
					EXCHANGE=35;
				}
				else if(EXCHANGE==49)
				{
					
					wr_lcd(comm,0x30);				
					EXCHANGE=50;
				}
				else if(z_up_speed_staus==4)
				{
					j=1;
					number(j);
					z_up_speed_staus=5;
	
					}
	
				else if(z_down_speed_staus==4)
				{
					j=1;
					number(j);
					z_down_speed_staus=5;
	
					}
	
	
	
			}

		}

		Cont.bits.R_INPUT2_MANAGE=0;

	}		




	if(Cont.bits.R_245==1)
	{
//		DelayUmSec(5);
		Back_xx_photo=xx_photo;//back xx_photo
		TRISF=0XFF;
		_TRISE5=1;
		TRISD=0X00;
		_TRISE8=0;
		PORTD=0x06;				//138	Y6=SW_EN	
		_RE8=0;
		_RD3=1;
		Nop();
		Nop();
		in_buffer=PORTF;
		staus[7]=_RE5;								//main3
		_RD3=0;


		//***********************************
		chk_busy();

		if(!BUSY)
		{

			if(KR_input==5)
			{	//j=2;
				if(!KR0)chn_disp15(tab15);	//x left limit
				else if(!KR1)chn_disp16(tab16);	// x right limit 
				else if(!KR2)chn_disp17(tab17);	//z up limit
				else if(!KR4)chn_disp13(tab13);	//y first limit
				else if(!KR5)chn_disp14(tab14);	//y back limit

				KR_input=6;
			}

		}

		//***************************************










		chk_busy();
		if(!BUSY)
		{
			if(xx_photo==1)
			{
				if(EXCHANGE==5)
				{
					wr_lcd(comm,0x30);
					EXCHANGE=6;
				}
				else if(EXCHANGE==20)
				{
					chn_disp2(tab2);
	//					j=5;
	//					wr_lcd(dat,chn2[j]);
					EXCHANGE=21;
				
				}
	
				else if(EXCHANGE==35)
				{
			
					array(y_distance,100);
			
					EXCHANGE=36;
				
				}
				//*******************************************
				else if(LCD_jingei_staus==5)//lcd refresh
				{
					j=2;
					number(j);
					LCD_jingei_staus=6;
					}
	
				else if(y_distance_staus==5)		//y_distance_refresh
				{
					j=2;
					number(j);
					
					y_distance_staus=6;

					}
	
				else if(y_totallength_staus==5)		//y_totallength_refresh
				{
	
					j=2;
					number(j);
					y_totallength_staus=6;
					}
	
	
			}
			else if(xx_photo==2)
			{
				if(EXCHANGE==5)
				{
					wr_lcd(comm,0x30);
					EXCHANGE=6;
				}
	
				else if(EXCHANGE==20)
				{
					wr_lcd(comm,0x88);
	
					EXCHANGE=21;
				}
				else if(EXCHANGE==35)
				{	
					wr_lcd(comm,0x8B);
					EXCHANGE=36;
				}
	
				else if(guangmo_times_staus==5)
				{
					j=2;
					number(j);
					guangmo_times_staus=6;
					}
	
				else if(z_waitpostion_staus==5)
				{
					j=2;
					number(j);
					z_waitpostion_staus=6;
					}
	
	
	
	
			}
	
			else if(xx_photo==3)
			{
				if(EXCHANGE==5)
				{
					wr_lcd(comm,0x30);
					EXCHANGE=6;
				}
	
				else if(EXCHANGE==20)
				{
					chn_disp9(tab9);
	//					j=1;
	//					wr_lcd(dat,chn9[j]);
	
					EXCHANGE=21;
				}
	
				else if(EXCHANGE==35)
				{
					j=3;
					number(j);
					EXCHANGE=36;
				}
	
				else if(y_postion_staus==5)
				{
					j=2;
					number(j);
					y_postion_staus=6;
					}
				else if(z_postion_staus==5)
				{
					j=2;
					number(j);
					z_postion_staus=6;
	
					}
	
	
	
	
	
	
			}
	
			else if(xx_photo==4)
			{
	
				if(EXCHANGE==5)
				{
					wr_lcd(comm,0x30);
					EXCHANGE=6;
				}
	
				else if(EXCHANGE==20)
				{
					wr_lcd(comm,0x88);
					
					EXCHANGE=21;
				}
				else if(EXCHANGE==35)
				{
					
					j=6;
					number(j);
					EXCHANGE=36;
				}
	
				else if(EXCHANGE==50)
				{
					
					wr_lcd(comm,0x0C);				
					EXCHANGE=51;
				}
				else if(z_up_speed_staus==5)
				{
					j=2;
					number(j);
					z_up_speed_staus=6;
	
					}
	
				else if(z_down_speed_staus==5)
				{
					j=2;
					number(j);
					z_down_speed_staus=6;
	
					}
	
	
	
			}		

		}


		Cont.bits.R_245=0;

	}	
	if(Cont.bits.R_245_MANAGE==1)
	{
//		DelayUmSec(5);
		Back_xx_photo=xx_photo;//back xx_photo
		staus[0]=in_buffer&0X01;						//stop
		staus[1]=in_buffer&0X02;						//start
		staus[2]=in_buffer&0X04;						//c
		staus[3]=in_buffer&0X08;						//mode1
		staus[4]=in_buffer&0X10;						//mode2
		staus[5]=in_buffer&0X20;						//main1
		staus[6]=in_buffer&0X40;						//main2

		motor_jingei=staus[5]*1+staus[6]*2+staus[7]*4;		//while key up staus=1;
		operator_mode=staus[3]+staus[4]*2;

		//**********************************************
		chk_busy();

		if(!BUSY)
		{

			if(KR_input==6)
			{	//j=3;
				if(!KR0)chn_disp15(tab15);	//x left limit
				else if(!KR1)chn_disp16(tab16);	// x right limit 
				else if(!KR2)chn_disp17(tab17);	//z up limit
				else if(!KR4)chn_disp13(tab13);	//y first limit
				else if(KR5)chn_disp14(tab14);	//y back limit

				KR_input=7;
			}

		}
		//***************************************************









		chk_busy();
		if(!BUSY)
		{
			if(xx_photo==1)
			{
				if(EXCHANGE==6)
				{
					wr_lcd(comm,0x80);
					EXCHANGE=7;
				}
	
				else if(EXCHANGE==21)
				{
					wr_lcd(comm,0x30);
					EXCHANGE=22;
				
				}
				else if(EXCHANGE==36)
				{
			
					wr_lcd(comm,0x30);
			
					EXCHANGE=37;
				
				}
	
				//***********************************************
				else if(LCD_jingei_staus==6)//lcd refresh
				{
					j=3;
					number(j);
					LCD_jingei_staus=7;
				}	
				else if(y_distance_staus==6)		//y_distance_refresh
				{
					j=3;
					number(j);
					
					y_distance_staus=7;

					}
				else if(y_totallength_staus==6)		//y_totallength_refresh
				{
	
					j=3;
					number(j);
					y_totallength_staus=7;
					}


	
			}
	
			else if(xx_photo==2)
	
			{
	
				if(EXCHANGE==6)
				{
					wr_lcd(comm,0x80);
					EXCHANGE=7;
				}
				else if(EXCHANGE==21)
				{
					chn_disp6(tab6);
	//				j=0;
	//				wr_lcd(dat,chn6[j]);
	
					EXCHANGE=22;
				}
	
				else if(EXCHANGE==36)
				{	
					j=1;
					number(j);
					EXCHANGE=37;
				}
				else if(guangmo_times_staus==6)
				{
					j=3;
					number(j);
					guangmo_times_staus=7;
					}
				else if(z_waitpostion_staus==6)
				{
					j=3;
					number(j);
					z_waitpostion_staus=7;
				}
	
	
	
	
	
			}
	
			else if(xx_photo==3)
			{
				if(EXCHANGE==6)
				{
					wr_lcd(comm,0x80);
					EXCHANGE=7;
				}
	
				else if(EXCHANGE==21)
				{
					chn_disp9(tab9);
	//					j=2;
	//					wr_lcd(dat,chn9[j]);
	
					EXCHANGE=22;
				}
	
				else if(EXCHANGE==36)
				{
					j=4;
					number(j);
					EXCHANGE=37;
				}
	
				else if(y_postion_staus==6)
				{
					j=3;
					number(j);
					y_postion_staus=7;
					}
	
	
				else if(z_postion_staus==6)
				{
					j=3;
					number(j);
					z_postion_staus=7;
	
					}
	
			}
	
			else if(xx_photo==4)
			{
				if(EXCHANGE==6)
				{
					wr_lcd(comm,0x80);
					EXCHANGE=7;
				}
	
				else if(EXCHANGE==21)
				{
					
					chn_disp12(tab12);
	//					j=0;
	//					wr_lcd(dat,chn12[j]);
	
					EXCHANGE=22;
				}
	
				else if(EXCHANGE==36)
				{
					
					j=7;
					number(j);
					EXCHANGE=37;
				}
				else if(z_up_speed_staus==6)
				{
					j=3;
					number(j);
					z_up_speed_staus=7;
	
					}
				else if(z_down_speed_staus==6)
				{
					j=3;
					number(j);
					z_down_speed_staus=7;
	
					}
	
	
	
	
	
	
			}	

		}

		Cont.bits.R_245_MANAGE=0;


	}		

	if(Cont.bits.W_OUTPUT1_MANAGE==1)
	{
//		DelayUmSec(5);
		Back_xx_photo=xx_photo;//back xx_photo
		out=0x00;
		out=LR_num.bits.LR7;
		out<<=1;
		out|=LR_num.bits.LR6;
		out<<=1;
		out|=LR_num.bits.LR5;
		out<<=1;
		out|=LR_num.bits.LR4;
		out<<=1;
		out|=LR_num.bits.LR3;
		out<<=1;
		out|=LR_num.bits.LR2;
		out<<=1;
		out|=LR_num.bits.LR1;
		out<<=1;
		out|=LR_num.bits.LR0;	

		Nop();
		Nop();
		Nop();
		//*****************************************
		chk_busy();
		if(!BUSY)
		{

			if(KR_input==7)
			{	//j=4;
				if(!KR0)chn_disp15(tab15);	//x left limit
				else if(!KR1)chn_disp16(tab16);	// x right limit 
				else if(!KR2)chn_disp17(tab17);	//z up limit
				else if(!KR4)chn_disp13(tab13);	//y first limit
				else if(KR5)chn_disp14(tab14);	//y back limit

				KR_input=8;
			}

		}
		//****************************************






		chk_busy();
		if(!BUSY)
		{
			if(xx_photo==1)
			{
				if(EXCHANGE==7)
				{
					chn_disp1(tab1);
	//					j=0;
	//					wr_lcd(dat,chn1[j]);
					EXCHANGE=8;
				
				}
	
				else if(EXCHANGE==22)
				{

⌨️ 快捷键说明

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