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

📄 pc1490.c

📁 用C51单片机做的防盗报警器测试程序,主要实现AC/DC电压测试,频率测试,电流测试,正弦信号发生,数字IN/OUT等功能!
💻 C
📖 第 1 页 / 共 5 页
字号:
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis2[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis2[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{
			
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_2[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_2[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis2[i] != '\0')
    			{
      				lcd_wdat(dis2[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			}   
/**************************************************************************/
			Port1B8255_write(1);  //T7 test/+13.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.03;
		  	temp*=1000;
			if ((temp>=Limit[2])&&(temp<=Limit[3]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis3[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis3[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{
	  		    lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_3[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_3[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis3[i] != '\0')
    			{
      				lcd_wdat(dis3[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }

/**************************************************************************/ 
	  	    Port1B8255_write(2); //T307   ++13.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.02;
		  	temp*=1000;
			if ((temp>=Limit[4])&&(temp<=Limit[5]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis4[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis4[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{
			
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_4[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_4[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis4[i] != '\0')
    			{
      				lcd_wdat(dis4[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
/**************************************************************************/ 
	  	    Port1B8255_write(3); //T152 Test/+2.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.01;
		  	temp*=1000;
			if ((temp>=Limit[6])&&(temp<=Limit[7]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis5[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis5[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_5[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_5[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis5[i] != '\0')
    			{
      				lcd_wdat(dis5[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
/**************************************************************************/
			Port1B8255_write(4); //T283 Test / 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[8])&&(temp<=Limit[9]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis6[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis6[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{
			
	  			lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_6[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_6[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis6[i] != '\0')
    			{
      				lcd_wdat(dis6[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
/**************************************************************************/ 
			Port1B8255_write(5); //T102 test / 3.5v  ???2.9V
  		    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[10])&&(temp<=Limit[11]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis7[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis7[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{
			
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_7[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_7[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis7[i] != '\0')
    			{
      				lcd_wdat(dis7[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
/**************************************************************************/ 
			Port1B8255_write(6); //T174 Test / 2.88v
  		    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[12])&&(temp<=Limit[13]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis8[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis8[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_8[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_8[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis8[i] != '\0')
    			{
      				lcd_wdat(dis8[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }
/*****************************************************************************/
			Port1B8255_write(7); //T193 Test / 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;
		  	temp*=1000;
			if ((temp>=Limit[14])&&(temp<=Limit[15]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis9[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis9[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_9[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_9[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis9[i] != '\0')
    			{
      				lcd_wdat(dis9[i]);     //显示结果 
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
				goto ERROR;
			    
    	     }

		
/**************************************************************************/
			Port1B8255_write(8);  //T194/+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;
		  	temp*=1000;
			if ((temp>=Limit[16])&&(temp<=Limit[17]))
		     {
				lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis46[i] != '\0')	     //显示字符"Test Pass"
     			{                         
       				lcd_wdat(dis46[i]);
       				i++;
     			}
				lcd_pos(0x40);             //设置显示位置为第二行第1个字符
    			i = 0;
    			while(dis10[i] != '\0')	   //显示结果
    			{
      				lcd_wdat(dis10[i]);      
      				i++;
    			}
				show_value(temp);           //n中数据处理与显示         
          		lcd_delay(50);
			
 			  }
		  	else
		  	{	 
		  		lcd_pos(0x00);               //设置显示位置为第一行的第1个字符
    			i = 0;
    			while(dis_10[i] != '\0')	     //显示字符"Test Fail "
     			{                         
       				lcd_wdat(dis_10[i]);
       				i++;

⌨️ 快捷键说明

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