int.c

来自「用51单片机实现IR解码」· C语言 代码 · 共 2,143 行 · 第 1/5 页

C
2,143
字号
							  	{
								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;

}

   Monitor=Get_IR_Data_Step+Philips_IR_RC6_Mode*1000;	  System_Flag_DispEvent=1; 

  

   
Process_Interrupt_Poiter++;
//process interrupt 7
   switch(Get_IR_Data_Step)

{
	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;
		case GET_CONTROL_BIT6_STEP:
		case GET_CONTROL_BIT5_STEP:
		case GET_CONTROL_BIT4_STEP:
		case GET_CONTROL_BIT3_STEP:
			        
					       	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+=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;

								}
					       	}
							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+=1;
											Previous_Interrupt_Edge_Tape=One_bit_End_Edge;
											  IR_Input_Bits_Buffer=(IR_Input_Bits_Buffer<<1)+1;//get the a bit '1'  
											
											break;
											
									      case INT_3_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;
											
											
										case INT_4_T:
											return;
											// 	Get_IR_Data_Step+=2;
										

⌨️ 快捷键说明

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