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

📄 pc1490.c

📁 用C51单片机做的防盗报警器测试程序,主要实现AC/DC电压测试,频率测试,电流测试,正弦信号发生,数字IN/OUT等功能!
💻 C
📖 第 1 页 / 共 5 页
字号:
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis10[i] != '\0')
    			{
      				lcd_wdat(dis10[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }

/**************************************************************************/ 
	  	    Port1B8255_write(9); //T98 /+5V
  		    Timer100ms=3;
			while(Timer100ms);
			write_ads(0x8c);
			read_ads();
			temp1=adc_hi;
			temp1=temp1<<8;
			temp1+=adc_lo;
		  	temp=(float)temp1/32768*2.048;
			temp*=1;
		  	temp*=1000;
			if ((temp>=Limit[18])&&(temp<=Limit[19]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis11[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis11[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{  
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_11[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_11[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis11[i] != '\0')
    			{
      				lcd_wdat(dis11[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
/**************************************************************************/ 
	  	    Port1B8255_write(10); //T290/3.96V
  		    Timer100ms=3;
			while(Timer100ms);
			write_ads(0x8c);
			read_ads();
			temp1=adc_hi;
			temp1=temp1<<8;
			temp1+=adc_lo;
		  	temp=(float)temp1/32768*2.048;
			temp*=1.04;  
		  	temp*=1000;
			if ((temp>=Limit[20])&&(temp<=Limit[21]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis12[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis12[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{   
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_12[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_12[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis12[i] != '\0')
    			{
      				lcd_wdat(dis12[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
/**************************************************************************/
			Port1B8255_write(11); //T33/3.4V
  		    Timer100ms=3;
			while(Timer100ms);
			write_ads(0x8c);
			read_ads();
			temp1=adc_hi;
			temp1=temp1<<8;
			temp1+=adc_lo;
		  	temp=(float)temp1/32768*2.048;
			temp*=1;	   //1.1
		  	temp*=1000;
			if ((temp>=Limit[22])&&(temp<=Limit[23]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis13[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis13[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{ 
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_13[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_13[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis13[i] != '\0')
    			{
      				lcd_wdat(dis13[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
/**************************************************************************/ 
     		Port1B8255_write(12); //T95/4.7V
  		    Timer100ms=3;
			while(Timer100ms);
			write_ads(0x8c);
			read_ads();
			temp1=adc_hi;
			temp1=temp1<<8;
			temp1+=adc_lo;
		  	temp=(float)temp1/32768*2.048;
			temp*=1;	   //1.1
		  	temp*=1000;
			if ((temp>=Limit[24])&&(temp<=Limit[25]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis14[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis14[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{ 
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_14[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_14[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis14[i] != '\0')
    			{
      				lcd_wdat(dis14[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
			 
/**************************************************************************/ 
     		Port1B8255_write(13); //T204/0.5V
  		    Timer100ms=3;
			while(Timer100ms);
			write_ads(0x8c);
			read_ads();
			temp1=adc_hi;
			temp1=temp1<<8;
			temp1+=adc_lo;
		  	temp=(float)temp1/32768*2.048;
			temp*=1;	   //1.1
		  	temp*=1000;
			if ((temp>=Limit[26])&&(temp<=Limit[27]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis15[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis15[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{ 
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_15[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_15[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis15[i] != '\0')
    			{
      				lcd_wdat(dis15[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
			 
/**************************************************************************/ 
     		Port1B8255_write(14); //T198/ 5V
  		    Timer100ms=3;
			while(Timer100ms);
			write_ads(0x8c);
			read_ads();
			temp1=adc_hi;
			temp1=temp1<<8;
			temp1+=adc_lo;
		  	temp=(float)temp1/32768*2.048;
			temp*=1;	   //1.1
		  	temp*=1000;
			if ((temp>=Limit[28])&&(temp<=Limit[29]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis16[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis16[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{ 
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_16[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_16[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis16[i] != '\0')
    			{
      				lcd_wdat(dis16[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
/**********************************************************************************/
			Port1B8255_write(15); //IC1 T107  Test
  		    Timer100ms=3;
			while(Timer100ms);
			write_ads(0x8c);
			read_ads();
			temp1=adc_hi;
			temp1=temp1<<8;
			temp1+=adc_lo;
		  	temp=(float)temp1/32768*2.048;
			temp*=1;	   //1.1
		  	temp*=1000;
			if ((temp>=350)&&(temp<=750))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis16[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis16[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{ 
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_16[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_16[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis16[i] != '\0')
    			{
      				lcd_wdat(dis16[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
			
/**************************************************************************/
			Init1_8255();
			Port1B8255_write(16); 
			Init2_8255();
     		Port2B8255_write(0); //T200 IC1 O/P 测试!
  		    Timer100ms=3;
			while(Timer100ms);
			write_ads(0x8c);
			read_ads();
			temp1=adc_hi;
			temp1=temp1<<8;
			temp1+=adc_lo;
		  	temp=(float)temp1/32768*2.048;
			temp*=1;
		  	temp*=1000;
			if ((temp>=0)&&(temp<=50))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis18[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis18[i]);      
      				i++;
    			}
				
 			  }
		  	else
		  	{ 
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis47[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis47[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis18[i] != '\0')
    			{
      				lcd_wdat(dis18[i]);     //显示结果 
      				i++;
    			}
				
				goto ERROR;
			    				 
    	     }
/**************************************************************************/			
	 		Port2B8255_write(1); //T172 IC5 O/P 测试!
  		    Timer100ms=3;
			while(Timer100ms);
			write_ads(0x8c);
			read_ads();
			temp1=adc_hi;
			temp1=temp1<<8;
			temp1+=adc_lo;
		  	temp=(float)temp1/32768*2.048;
			temp*=1;
		  	temp*=1000;
			if ((temp>=0)&&(temp<=50))

⌨️ 快捷键说明

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