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

📄 an11.bak

📁 采用PC104实现多串口通信,同时显示数据.此程序可以直接使用.
💻 BAK
📖 第 1 页 / 共 5 页
字号:
		jidai_flag=0;jidai_he=0;
		for(i=0;i<jidai_data_long;i++)
		{
		 jidai_communt_data[i]=ser_buffer[i]; jidai_he=jidai_communt_data[i]+jidai_he;

		 }

		jidai_communt_data[jidai_data_long]= ser_buffer[jidai_data_long];
		jidai_he=jidai_he&0xff;

		serial_comtz=COM_1;
		if(jidai_he==jidai_communt_data[jidai_data_long])
			{
			 t_data_communt(0x10,0x83,0x14);
			 setcolor(10);
			 setfillstyle(1,10);
			 fillellipse(165+7,155+5+3+2,7,6);

			 }
		else
			{
			 t_data_communt(0x10,0x83,0x6f);
			 setcolor(12);
			 setfillstyle(1,12);
			 fillellipse(165+7,155+5+3+2,7,6);

			 goto exitt;
			 }


		if(jidai_communt_data[3]==0x03)
		 {

			jidai_he=jidai_communt_data[7]<<8;
			jidai_he=jidai_he+jidai_communt_data[6];
			jidai_he=atoi(smg_cishu)-jidai_he;
			test_tongxin=jidai_he;
			jidai_he_t=atoi(smg_cishu);
			bili=test_tongxin/jidai_he_t;
			bili=bili*100;

			setcolor(7);
			outtextxy(60,213,smg_error);
			gcvt(test_tongxin,4,smg_error);
			setcolor(1);
			outtextxy(60,213,smg_error);

			setcolor(7);
			outtextxy(260,213,cbili);
			gcvt(bili,3,cbili);
			setcolor(1);
			outtextxy(260,213,cbili);
			delay(10);

			error_12_communt(COM_2);
			delay(12);
		  }

	  }

	 else
		{
		 i=0;
		 for(i=0;i<8;i++)
			 ji_communt_data[i]= ser_buffer[i];


			if(ji_communt_data[6]==0x14)
			 {

			 setcolor(10);
			 setfillstyle(1,10);
			 fillellipse(165+7,155+5+3+2,7,6);

			 }
		  else
			 {
			  setcolor(12);
			  setfillstyle(1,12);
			  fillellipse(165+7,155+5+3+2,7,6);
			 }

		}

	}

  else if(shanxin_over==1)
	{
			shanxin_over=0;
			 i=0;
			 for(i=0;i<8;i++)
			 sh_communt_data[i]= pser_buffer[i];


			if(sh_communt_data[6]==0x14)
			 {
			  setcolor(10);
			  setfillstyle(1,10);
			  fillellipse(295+7,155+5+3+2,7,6);
			 }
		  else
			 {
			  setcolor(12);
			  setfillstyle(1,12);
			  fillellipse(295+7,155+5+3+2,7,6);
			 }


	}

 else if(shanwei_over==1)
	{
	 shanwei_over=0;
	 shanwei_he=0;
	 if(shanwei_flag==1)
	 {
	  shanwei_he=0;
	  shanwei_flag=0;

	 for(i=0;i<shanwei_data_long;i++)
	  {
		 shanwei_communt_data[i]= sser_buffer[i]; shanwei_he=shanwei_communt_data[i]+shanwei_he;
		// printf("%x,",shanwei_communt_data[i]);
	  }

	 shanwei_communt_data[shanwei_data_long]= sser_buffer[shanwei_data_long];
	 shanwei_he=shanwei_he&0xff;

	 if(shanwei_communt_data[3]==0x01)
		shanwei_he_zhuan=0x81;
	 else if(shanwei_communt_data[3]==0x02)
		shanwei_he_zhuan=0x82;
	 else if(shanwei_communt_data[3]==0x04)
		shanwei_he_zhuan=0x84;
	 else if(shanwei_communt_data[3]==0x06)
		shanwei_he_zhuan=0x86;
	 else
		shanwei_he_zhuan=0;

	 serial_comtz=COM_1;

	 if(shanwei_he== shanwei_communt_data[shanwei_data_long])
	  {
		  t_data_communt(0x12,shanwei_he_zhuan,0x14);
		  setcolor(10);
		  setfillstyle(1,10);
		  fillellipse(56,155+5+3+2,7,6);
		  disp_canshu_communt();
	  }

	 else
		{
		 t_data_communt(0x12,shanwei_he_zhuan,0x6f);
			  setcolor(12);
			  setfillstyle(1,12);
			  fillellipse(56,155+5+3+2,7,6);
		 goto exitt;
		 }

	}
  else
  {
	  for(i=0;i<shanwei_data_long+1;i++)
				  {
					we_communt_data[i]= sser_buffer[i];}
					if(we_communt_data[6]==0x14)
					 {
					  setcolor(10);
					  setfillstyle(1,10);
					  fillellipse(56,155+5+3+2,7,6);
					 }
				  else
					 {

					  setcolor(12);
					  setfillstyle(1,12);
					  fillellipse(56,155+5+3+2,7,6);
					 }

	}


  }


}

exitt:  zhong_done=0;

malui_data_float=atof(&malui_data_flow);
huzaibo_data_y=malui_data_float;
huzaibo_data_y=36/huzaibo_data_y;



if(update==1)
{

 zhong_done=0;
	update=0;
	ch=key;

	switch(ch)
	 {
	  case 61:

		  esc=1;

		 break;
case 27:
		if(h==1)
			 {
			  zhong_done=0;
			  shui_x=shui_x+1;
			  if(shui_x==1)
				 {
				 x=a+5;y=b+31+1+24+24+24+25;
				 set_bar(&x,&y,15,312,25,0,0);

				 zhong_done=0;
				 x=a+76+7+1+10;y=b+31+1;
				 set_bar(&x,&y,7,45,17,0,0);

				 onSMcls(a+4,b+24+6,a+79+10,b+45+6);
				 setcolor(8);
				 outtextxy(a+76+7+1+15,b+31+2,malui_data_flow);

				 onSM1(a+4+155,b+24+6,a+79+155+10,b+45+6);
				 x=a+76+7+1+10+155;y=b+31+1;
				 set_bar(&x,&y,1,60,17,0,0);
				 setcolor(15);
				 outtextxy(a+76+7+1+10+155+4,b+31+1+2,smg_pinlui);

				 b0=0;
				 xx=a+76+7+1+10+155;yy=b+31+1+6;
				 setcolor(7);
				 setlinestyle(SOLID_LINE,1,1);
				 line(xx+3,yy+8,xx+9,yy+8);

				 xx=a+76+7+1+10+155+4;yy=b+31+1+2;
				 curx=a+76+7+1+10+155;cury=b+31+1+6;



				 h_x=2;
				 huanwei(h_x,0,0);

	br:		 break;
				  }

			  else if(shui_x==2)
				 {
				  b0=0;
				  cmp_updata=strcmp("1850000",smg_pinlui);

				  while(cmp_updata<0)
					 {
						 x=a+5;y=b+31+1+24+24+24+25;
						set_bar(&x,&y,15,312,25,0,0);

						hanzic(12,0,11);
						delay(120);
						hanzic(15,0,11);
						delay(120);


						onSM1(a+4+155,b+24+6,a+79+155+10,b+45+6);
						x=a+76+7+1+10+155;y=b+31+1;
						set_bar(&x,&y,1,60,17,0,0);
						setcolor(15);
						outtextxy(a+76+7+1+10+155+4,b+31+1+2,smg_pinlui);

						b0=0;
						xx=a+76+7+1+10+155;yy=b+31+1+6;
						setcolor(7);
						setlinestyle(SOLID_LINE,1,1);
						line(xx+3,yy+8,xx+9,yy+8);

						xx=a+76+7+1+10+155+4;yy=b+31+1+2;
						curx=a+76+7+1+10+155;cury=b+31+1+6;
						shui_x=1;
						cmp_updata1=1;

					}
					if(cmp_updata1==1)
						 {
						  cmp_updata3=strcmp("1750000",smg_pinlui);
						  while(cmp_updata3>0)
						  {
							 x=a+5;y=b+31+1+24+24+24+25;
				 set_bar(&x,&y,15,312,25,0,0);

							hanzic(12,15,22);
							delay(120);
							hanzic(15,15,22);
							delay(120);


							onSM1(a+4+155,b+24+6,a+79+155+10,b+45+6);
							x=a+76+7+1+10+155;y=b+31+1;
							set_bar(&x,&y,1,60,17,0,0);
							setcolor(15);
							outtextxy(a+76+7+1+10+155+4,b+31+1+2,smg_pinlui);

							b0=0;
							xx=a+76+7+1+10+155;yy=b+31+1+6;
							setcolor(7);
							setlinestyle(SOLID_LINE,1,1);
							line(xx+3,yy+8,xx+9,yy+8);

							xx=a+76+7+1+10+155+4;yy=b+31+1+2;
							curx=a+76+7+1+10+155;cury=b+31+1+6;
							shui_x=1;
							cmp_updata2=1;

							}
						 if(cmp_updata2==1)
							 {
							  char_comp_pinlui[0]=smg_pinlui[0];
							  char_comp_pinlui[1]=smg_pinlui[1];
							  char_comp_pinlui[2]=smg_pinlui[2];
							  char_comp_pinlui[3]=smg_pinlui[3];
							  char_comp_pinlui[4]=smg_pinlui[4];
							  char_comp_pinlui[5]=smg_pinlui[5];
							  char_comp_pinlui[6]=smg_pinlui[6];
							  break;
							  }

							 char_comp_pinlui[0]=smg_pinlui[0];
							 char_comp_pinlui[1]=smg_pinlui[1];
							 char_comp_pinlui[2]=smg_pinlui[2];
							 char_comp_pinlui[3]=smg_pinlui[3];
							 char_comp_pinlui[4]=smg_pinlui[4];
							 char_comp_pinlui[5]=smg_pinlui[5];
							 char_comp_pinlui[6]=smg_pinlui[6];
						  break;
						 }

						cmp_updata3=strcmp("1750000",smg_pinlui);
						while(cmp_updata3>0)
						  {
							 x=a+5;y=b+31+1+24+24+24+25;
							set_bar(&x,&y,15,312,25,0,0);

						 hanzic(12,11,22);
						delay(120);
						hanzic(15,11,22);
						delay(120);



					 onSM1(a+4+155,b+24+6,a+79+155+10,b+45+6);
					 x=a+76+7+1+10+155;y=b+31+1;
					 set_bar(&x,&y,1,60,17,0,0);
					 setcolor(15);
					 outtextxy(a+76+7+1+10+155+4,b+31+1+2,smg_pinlui);

					 b0=0;
					 xx=a+76+7+1+10+155;yy=b+31+1+6;
					 setcolor(7);
					 setlinestyle(SOLID_LINE,1,1);
					 line(xx+3,yy+8,xx+9,yy+8);

					 xx=a+76+7+1+10+155+4;yy=b+31+1+2;
					 curx=a+76+7+1+10+155;cury=b+31+1+6;
					 shui_x=1;
					 cmp_updata2=1;

							}
						 if(cmp_updata2==1)
							{
					 char_comp_pinlui[0]=smg_pinlui[0];
					 char_comp_pinlui[1]=smg_pinlui[1];
					 char_comp_pinlui[2]=smg_pinlui[2];
					 char_comp_pinlui[3]=smg_pinlui[3];
					 char_comp_pinlui[4]=smg_pinlui[4];
					 char_comp_pinlui[5]=smg_pinlui[5];
					 char_comp_pinlui[6]=smg_pinlui[6];
								break;
							}
						

					 zhong_done=0;


				 x=a+5;y=b+31+1+24+24+24+25;
				 set_bar(&x,&y,15,312,25,0,0);

				// h_x=1;
				// huanwei(h_x);

				 x=a+76+7+1+10+155;y=b+31+1;
				 set_bar(&x,&y,7,60,17,0,0);

				 onSMcls(a+4+155,b+24+6,a+79+155+10,b+45+6);
				 setcolor(8);
				 outtextxy(a+76+7+1+15+155,b+31+2,smg_pinlui);

				 onSM1(a+4,b+24+6+24,a+79+10,b+45+6+24);
				 x=a+76+7+1+10;y=b+31+1+24;
				 set_bar(&x,&y,1,45,17,0,0);
				 setcolor(15);
				 outtextxy(a+76+7+1+10+2+2,b+31+1+2+24,huzaibo_data_char);
				 huanwei(3,0,0);

				  break;
				 }
			  else if(shui_x==3)
				{

				 zhong_done=0;
				 x=a+5;y=b+31+1+24+24+24+25;
				 set_bar(&x,&y,15,312,25,0,0);

				 b0=0;

				 x=a+76+7+1+10;y=b+31+1+24;
				 set_bar(&x,&y,7,45,17,0,0);

				 onSMcls(a+4,b+24+6+24,a+79+10,b+45+6+24);
				 setcolor(8);
				 outtextxy(a+76+7+1+10+2+2,b+31+1+2+24,huzaibo_data_char);

				 onSM1(a+4+155,b+24+6+24,a+79+10+155,b+45+6+24);
				 x=a+76+7+1+10+155;y=b+31+1+24;
				 set_bar(&x,&y,1,60,17,0,0);
				 setcolor(15);
				 outtextxy(a+76+7+1+10+155+4,b+31+1+2+24,smg_pinpian);

				 xx=a+76+7+1+10+155;yy=b+31+1+6+24;
				 setcolor(7);
				 setlinestyle(SOLID_LINE,1,1);
				 line(xx+3,yy+8,xx+9,yy+8);
				 xx=a+76+7+1+10+155+4;yy=b+31+1+2+24;
				 curx=a+76+7+1+10+155;cury=b+31+1+6+24;


				 h_x=4;
				 huanwei(h_x,0,0);


				 break;

				}
			  else if(shui_x==4)
				{
				  b0=0;

				cmp_updata=strcmp("50",smg_pinpian);

				  while(cmp_updata<0)
					 {
						 x=a+5;y=b+31+1+24+24+24+25;
						 set_bar(&x,&y,15,312,25,0,0);

						hanzic(12,0,11);
						delay(120);
						hanzic(15,0,11);
						delay(120);

						onSM1(a+4+155,b+24+6+24,a+79+10+155,b+45+6+24);
						x=a+76+7+1+10+155;y=b+31+1+24;
						set_bar(&x,&y,1,60,17,0,0);
						setcolor(15);
						outtextxy(a+76+7+1+10+155+4,b+31+1+2+24,smg_pinpian);

						xx=a+76+7+1+10+155;yy=b+31+1+6+24;
						setcolor(7);
						setlinestyle(SOLID_LINE,1,1);
						line(xx+3,yy+8,xx+9,yy+8);
						xx=a+76+7+1+10+155+4;yy=b+31+1+2+24;
						curx=a+76+7+1+10+155;cury=b+31+1+6+24;

						shui_x=3;
						cmp_updata1=1;

					 }
					if(cmp_updata1==1)
						 {
						  cmp_updata3=strcmp("15",smg_pinpian);
						  while(cmp_updata3>0)
						  {
								 x=a+5;y=b+31+1+24+24+24+25;
				 set_bar(&x,&y,15,312,25,0,0);

							hanzic(12,11,22);
							delay(120);
							hanzic(15,11,22);
							delay(120);

							onSM1(a+4+155,b+24+6+24,a+79+10+155,b+45+6+24);
							x=a+76+7+1+10+155;y=b+31+1+24;
							set_bar(&x,&y,1,60,17,0,0);
							setcolor(15);
							outtextxy(a+76+7+1+10+155+4,b+31+1+2+24,smg_pinpian);

							xx=a+76+7+1+10+155;yy=b+31+1+6+24;
							setcolor(7);
							setlinestyle(SOLID_LINE,1,1);
							line(xx+3,yy+8,xx+9,yy+8);
							xx=a+76+7+1+10+155+4;yy=b+31+1+2+24;
							curx=a+76+7+1+10+155;cury=b+31+1+6+24;

							shui_x=3;
							cmp_updata2=1;

							}
						 if(cmp_updata2==1)
							 { char_comp_pinpian[0]=smg_pinpian[0];
								char_comp_pinpian[1]=smg_pinpian[1];
							  break;
							  }
							char_comp_pinpian[0]=smg_pinpian[0];
							char_comp_pinpian[1]=smg_pinpian[1];
						  break;
						 }

					  cmp_updata3=strcmp("15",smg_pinpian);
					  while(cmp_updata3>0)
						  {
								 x=a+5;y=b+31+1+24+24+24+25;
				 set_bar(&x,&y,15,312,25,0,0);

							hanzic(12,11,22);
							delay(120);
							hanzic(15,11,22);
							delay(120);

							onSM1(a+4+155,b+24+6+24,a+79+10+155,b+45+6+24);
							x=a+76+7+1+10+155;y=b+31+1+24;
							set_bar(&x,&y,1,60,17,0,0);
							setcolor(15);
							outtextxy(a+76+7+1+10+155+4,b+31+1+2+24,smg_pinpian);

							xx=a+76+7+1+10+155;yy=b+31+1+6+24;
							setcolor(7);
							setlinestyle(SOLID_LINE,1,1);
							line(xx+3,yy+8,xx+9,yy+8);
							xx=a+76+7+1+10+155+4;yy=b+31+1+2+24;
							curx=a+76+7+1+10+155;cury=b+31+1+6+24;

							shui_x=3;
							cmp_updata2=1;

							}
						 if(cmp_updata2==1)
							{
								char_comp_pinpian[0]=smg_pinpian[0];
								 char_comp_pinpian[1]=smg_pinpian[1];
								break;
							}


						 
				 zhong_done=0;
				 x=a+5;y=b+31+1+24+24+24+25;
				 set_bar(&x,&y,15,312,25,0,0);

				 x=a+76+7+1+10+155;y=b+31+1+24;
				 set_bar(&x,&y,7,60,17,0,0);

				 onSMcls(a+4+155,b+24+6+24,a+79+10+155,b+45+6+24);
				 setcolor(8);
				 outtextxy(a+76+7+1+10+2+2+155,b+31+1+2+24,smg_pinpian);

				 onSM1(a+4,b+24+6+24+24,a+79+10,b+45+6+24+24);
				 x=a+76+7+1+10;y=b+31+1+24+24;
				 set_bar(&x,&y,1,45,17,0,0);
				 setcolor(15);
				 x=a+76+7+1+10+5;y=b+31+1+24+24;
				 change_han(jiazait_start,jiazait_over,&x,&y,15);


				 huanwei(5,0,0);
				// h_x=1;
				// huanwei(h_x);

				 break;
				 }
			  else if(shui_x==5)
				{

				 zhong_done=0;
				 b0=0;
					 x=a+5;y=b+31+1+24+24+24+25;
				 set_bar(&x,&y,15,312,25,0,0);

				 x=a+76+7+1+10;y=b+31+1+24+24;
				 set_bar(&x,&y,7,45,17,0,0);

				 onSMcls(a+4,b+24+6+24+24,a+79+10,b+45+6+24+24);
				 x=a+76+7+1+10+5;y=b+31+1+24+24;
				 change_han(jiazait_start,jiazait_over,&x,&y,8);

				 if(tzhong_jiazai==1)
				 {
				 onSM1(a+4+155,b+24+6+24+24,a+79+10+155,b+45+6+24+24);
				 x=a+76+7+1+10+155;y=b+31+1+24+24;
				 set_bar(&x,&y,1,60,17,0,0);
				 setcolor(15);
				 outtextxy(a+76+7+1+10+2+2+155,b+31+1+2+24+24,smg_gonglui);

				  xx=a+76+7+1+10+155;yy=b+31+1+6+24+24;

⌨️ 快捷键说明

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