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

📄 int1.c

📁 用51单片机实现IR解码
💻 C
📖 第 1 页 / 共 5 页
字号:
					
			       default:
				   	return;
			  	}
		     break;
		case GET_MODE_BIT1_STEP:
			if(Previous_Interrupt_Edge_Tape==One_bit_End_Edge)
				{
				
				      switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
				  	{
					case INT_2_T:
						Get_IR_Data_Step=GET_MODE_BIT2_STEP;
						Previous_Interrupt_Edge_Tape=One_bit_End_Edge;
						IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<1)+0x01; //get the mode 101
						      Philips_IR_RC6_Mode=0x05;
						break;
						
				      case INT_3_T:  
    						 return;
						/* not valid 
						Get_IR_Data_Step=GET_MODE_BIT1_STEP;
						Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
					        IR_Input_Bits_Buffer=0x01;  // get the mode 010
					        */
					   
						break;
						
						
					case INT_4_T:
						Get_IR_Data_Step=GET_TRAILER_FALLING_STEP;
						Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;
					        IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<1)+0x01;  // get the mode 101
					              Philips_IR_RC6_Mode=0x05;
						break;
				       default:
					   	return;
				  	}
				}
			else if(Previous_Interrupt_Edge_Tape==Zero_Bit_Falling_Edge)
				{
				   switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
				  	{
					case INT_2_T:
						Get_IR_Data_Step=GET_MODE_BIT2_STEP;
						Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
						IR_Input_Bits_Buffer=0x00;
						 Philips_IR_RC6_Mode=0x00;
						break;
						
				      case INT_3_T:  
						Get_IR_Data_Step=GET_MODE_BIT2_STEP;
						Previous_Interrupt_Edge_Tape=One_bit_End_Edge;
					        IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<1)+0x01;  // get the mode 101 or 001
						break;
						
						
					case INT_4_T:
						return;
						/*not valid
						Get_IR_Data_Step=GET_MODE_BIT2_STEP;
						Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
					        IR_Input_Bits_Buffer=0x02;  // get the mode 010
					        */
						break;
				       default:
					   	return;
				  	}

				}
			break;
		case GET_MODE_BIT2_STEP://Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
				 switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
				  	{
					case INT_2_T:
						return;
						/*not valid
						Get_IR_Data_Step=GET_MODE_BIT1_STEP;
						Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
						IR_Input_Bits_Buffer=0x00;
						*/
						break;
						
				      case INT_3_T:  
					  	
						Get_IR_Data_Step=GET_TRAILER_FALLING_STEP;
						Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;
					        IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<1)+0;
					      Philips_IR_RC6_Mode=IR_Input_Bits_Buffer;
						break;
						
						
					case INT_4_T:
							return;
						/*not valid
						Get_IR_Data_Step=GET_MODE_BIT2_STEP;
						Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
					        IR_Input_Bits_Buffer=0x02;  // get the mode 010
					        */
						break;
					 case INT_5_T:  
								  	
									Get_IR_Data_Step=GET_TRAILER_STEP;
									Previous_Interrupt_Edge_Tape=TRAILER_Bit_End_Edge;
								     //   IR_Input_Bits_Buffer=IR_Input_Bits_Buffer<<1;
									  //    Philips_IR_RC6_Mode=IR_Input_Bits_Buffer;
									break;
				       default:
					   	return;
				  	}
			break;

}


   Process_Interrupt_Poiter++;

   Monitor=Get_IR_Data_Step+Philips_IR_RC6_Mode*1000;	  System_Flag_DispEvent=1; 
   
//process interrupt 5
switch(Get_IR_Data_Step)

{
		case GET_MODE_BIT1_STEP://					Previous_Interrupt_Edge_Tape=One_bit_End_Edge;
		                     

				  switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
				  	{
					case INT_2_T:
						Get_IR_Data_Step=GET_MODE_BIT2_STEP;
						Previous_Interrupt_Edge_Tape=One_bit_End_Edge;
						IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<1)+0x01; 
						 Philips_IR_RC6_Mode=IR_Input_Bits_Buffer;
						break;
						
				      case INT_3_T:  
    						 return;
						/* not valid 
						Get_IR_Data_Step=GET_MODE_BIT1_STEP;
						Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
					        IR_Input_Bits_Buffer=0x01;  // get the mode 010
					        */
					   
						break;
						
						
					case INT_4_T:
						Get_IR_Data_Step=GET_TRAILER_FALLING_STEP;
						Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;
					        IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<1)+0x01;  // 
					              Philips_IR_RC6_Mode=IR_Input_Bits_Buffer;
						break;
				       default:
					   	return;
				  	
			  	}
					break;
		case GET_MODE_BIT2_STEP:           
						if(Previous_Interrupt_Edge_Tape==Zero_Bit_Falling_Edge)
						{
						 switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
							  	{
								case INT_2_T:
									return;
									/*not valid
									Get_IR_Data_Step=GET_MODE_BIT1_STEP;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
									IR_Input_Bits_Buffer=0x00;
									*/
									break;
									
							      case INT_3_T:  
								  	
									Get_IR_Data_Step=GET_TRAILER_FALLING_STEP;
									Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;
								     //   IR_Input_Bits_Buffer=IR_Input_Bits_Buffer<<1;
								    //  Philips_IR_RC6_Mode=IR_Input_Bits_Buffer;
									break;
									
									
								case INT_4_T:
										return;
									/*not valid
									Get_IR_Data_Step=GET_MODE_BIT2_STEP;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								        IR_Input_Bits_Buffer=0x02;  // get the mode 010
								        */
									break;
							     case INT_5_T:  
								  	
									Get_IR_Data_Step=GET_TRAILER_STEP;
									Previous_Interrupt_Edge_Tape=TRAILER_Bit_End_Edge;
								     //   IR_Input_Bits_Buffer=IR_Input_Bits_Buffer<<1;
									  //    Philips_IR_RC6_Mode=IR_Input_Bits_Buffer;
									break;
							 case INT_6_T:  
								  	
									Get_IR_Data_Step=GET_CONTROL_BIT7_STEP;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								    IR_Input_Bits_Buffer=0;
									break;
							       default:
								   	return;
							  	}

						}
				         else  if(    Previous_Interrupt_Edge_Tape==One_bit_End_Edge)
								       
					      	{

							switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
							  	{
								case INT_2_T:
								
									Get_IR_Data_Step=GET_TRAILER_FALLING_STEP;
									Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;
									
									break;
									
							      case INT_3_T:  
								  	return;
									
									break;
									
									
								case INT_4_T:
									Get_IR_Data_Step=GET_TRAILER_STEP;
									Previous_Interrupt_Edge_Tape=TRAILER_Bit_End_Edge;
								     
									break;
							     case INT_5_T:  
								  	
									Get_IR_Data_Step=GET_CONTROL_BIT7_STEP;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								       IR_Input_Bits_Buffer=0;//get the first control bit
									 
									break;
							       default:
								   	return;
							  	}

					      	}
	
				break;

					
		case GET_TRAILER_FALLING_STEP://			Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;

	                     	switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
							  	{
								case INT_2_T:
								    return;
									//Get_IR_Data_Step=GET_TRAILER_FALLING_STEP;
									//Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;
									
									break;
									
							      case INT_3_T:  
								  		Get_IR_Data_Step=GET_CONTROL_BIT7_STEP;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								       IR_Input_Bits_Buffer=0;//get the first control bit
									
									break;
									
									
								case INT_4_T:
									   return;
									//Get_IR_Data_Step=GET_TRAILER_STEP;
									//Previous_Interrupt_Edge_Tape=TRAILER_Bit_End_Edge;
								     
									break;
							     case INT_5_T:  
								  	  return;
									//Get_IR_Data_Step=GET_CONTROL_STEP;
									//Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								       //IR_Input_Bits_Buffer=0;//get the first control bit
									 
									break;
							       default:
								   	return;
							  	}

					
					break;
		
		

}

   Monitor=Get_IR_Data_Step+Philips_IR_RC6_Mode*1000;	  System_Flag_DispEvent=1; 
  
      Process_Interrupt_Poiter++;
   //process interrupt 6
switch(Get_IR_Data_Step)

{
		case GET_MODE_BIT2_STEP://					Previous_Interrupt_Edge_Tape=One_bit_End_Edge;
		                     

				  switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
				  	{
					
					                  case INT_2_T:
								
									Get_IR_Data_Step=GET_TRAILER_FALLING_STEP;
									Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;
									
									break;
									
							      case INT_3_T:  
								  	return;
									
									break;
									
									
								case INT_4_T:
									Get_IR_Data_Step=GET_TRAILER_STEP;
									Previous_Interrupt_Edge_Tape=TRAILER_Bit_End_Edge;
								     
									break;
							     case INT_5_T:  
								  	
									Get_IR_Data_Step=GET_CONTROL_BIT7_STEP;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								       IR_Input_Bits_Buffer=0;//get the first control bit
									 
									break;
							       default:
								   	return;
							  	

				  	
			  	}
					break;
		case GET_TRAILER_FALLING_STEP:           //Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;
						
						 switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
							  	{
							  	case INT_2_T:
								    return;
									//Get_IR_Data_Step=GET_TRAILER_FALLING_STEP;
									//Previous_Interrupt_Edge_Tape=TRAILER_Bit_Falling_Edge;
									
									break;
									
							      case INT_3_T:  
								  		Get_IR_Data_Step=GET_CONTROL_BIT7_STEP;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								       IR_Input_Bits_Buffer=0;//get the first control bit
									
									break;
									
									
								case INT_4_T:
									   return;
									//Get_IR_Data_Step=GET_TRAILER_STEP;
									//Previous_Interrupt_Edge_Tape=TRAILER_Bit_End_Edge;
								     
									break;
							     case INT_5_T:  
								  	  return;
									//Get_IR_Data_Step=GET_CONTROL_STEP;
									//Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								       //IR_Input_Bits_Buffer=0;//get the first control bit
									 
									break;
							       default:
								   	return;
							  	}

								
								
							  	
						
				   
							 break;

					
		case GET_TRAILER_STEP://			Previous_Interrupt_Edge_Tape=TRAILER_Bit_End_Edge;

	                     	switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
					       {
					                    case INT_2_T:
								    return;
									Get_IR_Data_Step=GET_CONTROL_BIT7_STEP;
									Previous_Interrupt_Edge_Tape=One_bit_End_Edge;
									  IR_Input_Bits_Buffer=1;//get the first control bit 1XXX XXXX
									break;
									
							      case INT_3_T:  
								  		Get_IR_Data_Step=GET_CONTROL_BIT7_STEP;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								       IR_Input_Bits_Buffer=0;//get the first control bit
									
									break;
									
									
								case INT_4_T:
									   return;
								
								     
									break;
							        default:
								   	return;
							  	}

	                     		
					break;
		
		case GET_CONTROL_BIT7_STEP://Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
			          switch(IR_Interrup_Time_Sequece[Process_Interrupt_Poiter])
					       {
					                    case INT_2_T:
								
									Get_IR_Data_Step+=1;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
									  IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<1)+0;//get the a bit '0'  
									
									break;
									
							      case INT_3_T:  
								  		Get_IR_Data_Step+=1;
									Previous_Interrupt_Edge_Tape=One_bit_End_Edge;
								       IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<1)+0x1;//get the bit '1'
									
									break;
									
									
								case INT_4_T:
									 	Get_IR_Data_Step+=2;
									Previous_Interrupt_Edge_Tape=Zero_Bit_Falling_Edge;
								       IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<2)+0x2;//get the bit '10'
								     
									break;
							        default:
								   	return;
	                     		}
					break;

⌨️ 快捷键说明

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