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

📄 otelc.c

📁 一种电话遥控板的原程序
💻 C
字号:
extern void send_ht9200(uchar in) ;

void OTel_RP_ZJ()
{
	SW =  1 ;
	SendDxFlag = 2 ;	
	Phone_ToneCtrl(TRUE) ;
}
void OTel_RP_GJ()
{
	SW =  0 ;	SW =  0 ;
	SendDxFlag = FALSE ;
	IsInputRing = 0 ;
	Stop_Play_flag = 0 ;
	Is_TongHua_flag = 0 ;
	Busy_Cout_flag = 0 ;
	Huilingying_flag = 0 ;
	Checked_DFZJ_flag = 0 ;
	Huilingying_dingshi = 0 ;
	Busy_analyse_flag = 0 ;
	Sys_TimerRelease(OTimerID1) ;
	Phone_ToneCtrl(FALSE) ;
	if(Checked_playend_flag == 1)
	{
		Checked_playend_flag = 0 ;
		Send_Stop_Play() ;			//stop play
	}
	delay(600) ;
}
void Send_Code(uchar no)
{
	send_ht9200(no) ;
	delay(100) ;
}

void OTel_RP_Init()
{
	 SendDxFlag = FALSE ;
	 IsInputRing = 0 ;
	 Stop_Play_flag = 0 ;
	 Busy_Cout_flag = 0 ;
	 Huilingying_flag = 0 ;
	 Huilingying_dingshi = 0 ;
	 Callid_Ring_time = 0 ;
	 Busy_analyse_flag = 0 ;
}

void OTel_Rece_DTMF() using 2
{
	uchar temp_ret,temp_data ;
	temp_ret = check_DV() ;			//check dtmf dv
	if(temp_ret == TRUE)
	{
		temp_data = DTMF_read() ;	//in data
		if(Is_TongHua_flag ==1)
		{
			disp_buf = temp_data ;
			if(Checked_playend_flag == 1)
			{
				Checked_playend_flag = 0 ;
				Stop_Play_flag = 1 ;
				//Stop_Play() ;			//stop play
				Serial_SendCommandR("ATFEND#",7) ;
			}
			Serial_SendCommandR("ATN",3) ;
			Serial_SendCommandR(&temp_data,1) ;  //
			Serial_SendCommandR("#",1) ;
		}
	}
}

void OTel_RP_Check()
{
	uchar temp_ret ;
//	uchar code tablef[17] = "0123456789abcd*#" ;

//	/*并机电话使用检测*/
	temp_ret = Check_DXC() ;
	if((temp_ret == TRUE)&&(SendDxFlag != 2))
	{
		disp_buf = 16 ;
		SendDxFlag = TRUE ;
		Serial_SendCommand("ATTON#",6) ;
	}
	else if((temp_ret == FALSE)&&(Check_DX_flag == 0))
	{
		if(SendDxFlag == TRUE)
		{
			SendDxFlag = FALSE ;
			disp_buf = 22 ;
			Serial_SendCommand("ATTOFF#",7) ;
		}
	}
/*	CALLID FSK模式
	if(CallidFlag == TRUE)
	{
		EA = 0 ;
		temp_ret = CallIDProc() ;
		EA = 1 ;
		if(temp_ret == OK)
		{
			if(CallIDFormat == 0x80)	//MDMF format
			{
				disp_buf = 21 ;
				callid_close() ;
				Serial_SendCommand("ATCALLID",8) ;
				Serial_SendCommand(COMBuffer+13,COMBuffer[12]) ;
				Serial_SendCommand("#",1) ;
			}
			else if(CallIDFormat == 0x04)	//SDMF format
			{
				disp_buf = 18 ;
				callid_close() ;
				Serial_SendCommand("ATCALLID",8) ;
				Serial_SendCommand(COMBuffer+9,COMBuffer[0]-8) ;
				Serial_SendCommand("#",1) ;
			}
		}
		else if(temp_ret == 2)
		{
			callid_close() ;
		}
	}
//	/DTMF CALLID模式/
	temp_ret = check_FSK_DV() ;			//check FSK dtmf dv
	if(temp_ret == TRUE)
	{
		temp_data = DTMF_read() ;	//in FSK data
		if(Is_TongHua_flag ==1)
		{
			disp_buf = temp_data ;
			if(Checked_playend_flag == 1)
			{
				Checked_playend_flag = 0 ;
				Stop_Play() ;			//stop play
				Serial_SendCommand("ATFEND#",7) ;
			}
			Serial_SendCommand("ATN",3) ;
			Serial_SendCommand(&temp_data,1) ;  //
			Serial_SendCommand("#",1) ;
		}
		else // CALLID DTMF处理
		{
			//if(temp_data != 0x0d)
			//{
				disp_buf = temp_data ;
				COMBuffer[COMBufferLen] = temp_data ;
				if(COMBufferLen < COMMaxByte-1) COMBufferLen++ ;
			/}
			else
			{
				Serial_SendCommand("ATCALLID",8) ;
				Serial_SendCommand(COMBuffer,COMBufferLen) ;
				Serial_SendCommand("#",1) ;
			}/
		}
	}
*/	
/*	temp_ret = check_DV() ;			//check dtmf dv
	if(temp_ret == TRUE)
	{
		temp_data = DTMF_read() ;	//in data
		if(Is_TongHua_flag ==1)
		{
			disp_buf = temp_data ;
			if(Checked_playend_flag == 1)
			{
				Checked_playend_flag = 0 ;
				Stop_Play() ;			//stop play
				Serial_SendCommand("ATFEND#",7) ;
			}
			Serial_SendCommand("ATN",3) ;
			Serial_SendCommand(&temp_data,1) ;  //
			Serial_SendCommand("#",1) ;
		}
	}
	*/
	if(Stop_Play_flag == 1)
	{
		Stop_Play_flag = 0 ;
		Send_Stop_Play() ;			//stop play
	}
	if(Checked_playend_flag == 1)			//放音放完了
	{
		if(RDY == 1)
		{
			Checked_playend_flag = 0 ;
			Serial_SendCommand("ATFEND#",7) ;
		}
	}
	
//	/*振铃检测*/
	temp_ret = check_RING() ;				//ring check 
	if(temp_ret == TRUE)
	{
		disp_buf = 23 ;
		Serial_SendCommand("ATRing#",7) ;
		delay(1150) ;
/*		if(Callid_Ring_time <= 1)			//第二次振铃到
		{
			if(COMBufferLen > 2)			//有DTMF方式来的来电号码
			{
				Serial_SendCommand("ATCALLID",8) ;
				Serial_SendCommand(COMBuffer,COMBufferLen) ;
				Serial_SendCommand("#",1) ;
			}
		}
		temp_ret = Sys_TimerReqire(OTimerID0,70,0) ;		//超时处理
		delay(1200) ;
		if(Callid_Ring_time == 0)
			callid_open() ;*/
		Callid_Ring_time++ ;
		IsInputRing = 1 ;
		temp_ret = Sys_TimerReqire(OTimerID0,70,0) ;		//超时处理
	}
	//是否需要定时
	if((Huilingying_flag == 1)&&(Huilingying_dingshi == 1))
	{
		Huilingying_dingshi = 0 ;
		temp_ret = Sys_TimerReqire(OTimerID1,80,0) ;		//超时处理
	}
//	/*定时器分析*/
	temp_ret = Analyse_OTimerID() ;
	if(temp_ret == OTimerID0)
	{
		disp_buf = 0xff ;
		Callid_Ring_time = 0 ;
	}
	else if(temp_ret == OTimerID1)
	{
		Huilingying_flag = 0 ;
		Huilingying_dingshi = 0 ;
		Busy_analyse_flag = 1 ;
		Checked_DFZJ_flag = 1 ;
		Phone_ToneCtrl(TRUE) ;
		Serial_SendCommand("ATDFZJ#",7) ;
	}
	else if(temp_ret == OTimerID2)
	{
		Busy_Cout_flag = 0 ;
	}
//	/*忙音检测*/
	if(Busy_analyse_flag == 1)
	{
		if(ToneKind == 0x30)
		{
			Busy_Cout_flag ++ ;
			if(Busy_Cout_flag < 4)
			{
				Phone_ToneCtrl(TRUE) ;
				temp_ret = Sys_TimerReqire(OTimerID2,15,0) ;		//超时清除变量处理
			}
			else
			{
//				if(Checked_DFZJ_flag == 1)
					Serial_SendCommand("ATDFGJ#",7) ;
				OTel_RP_GJ() ;
				Phone_ToneCtrl(FALSE) ;
				Sys_TimerRelease(OTimerID1) ;
			}
		}
	}
/*/	/按键检测/
	temp_ret = check_VIN() ;				//VIN check 
	if(temp_ret == TRUE)
	{
		if(VIN_frist_flag == 1)				//VOUT Contral open
		{
			disp_buf = 26 ;
			VIN_frist_flag = 0 ;
			VOUT = 0 ;
		}
		else								//VOUT Contral close
		{
			disp_buf = 0xff ;
			VIN_frist_flag = 1 ;
			VOUT = 1 ;
		}
	}
	*/
}

⌨️ 快捷键说明

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