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

📄 jiema.c

📁 keil c open
💻 C
📖 第 1 页 / 共 4 页
字号:
			sendtwo=0x84;
			sendthree=0x00;
			sendfour=0x00;
			f_sendbytes();
		}
		if(privacy_clear_flag==1)
		{
			privacy_clear_flag=0;
			sendtwo=0x84;
			if(function1<=24)
			sendthree=function1;
			sendfour=0x07;
			f_sendbytes();
		}
	}
}
/*
******************************************************************************************

*名称:TASK	f_set_cruise_number(void)
*功能:*  设置巡航队列号
*修改参数:sendone,sendthree,sendtwo
* 输入参数:速度值
*输出参数:无
*处理的数据:无
*调用的函数:

		f_dummy();

*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
******************************************************************************************
*/
void f_set_alram_point()
{
	sendtwo=0xA0;
	sendthree=function1+64;
	sendfour=0;
	
}
TASK	f_set_cruise_number(void)
{
	call_team_flag=0;
	//uchar	xdata	alarm_set_input_flag;
	if(alarm_set_input_flag==1)
	{
		f_set_alram_point();
		return;
	}
else
	{
		number=function1;
		if(number<20)
		{
	  	   	num=0;
			set_team_flag=1;
			call_team_flag=0;
		}
		f_dummy();
	}
}
/*
*******************************************************************************************

*名称:TASK	f_set_cruise(void)
*功能:**设置巡航点
*修改参数:sendone,sendthree,sendtwo
* 输入参数:速度值
*输出参数:无
*处理的数据:无
*调用的函数:
		wren_cmd();
		byte_write(function1,my_address);
		f_dummy();

*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
*
*********************************************************************************************
*/
TASK	f_set_cruise(void)
{
   
TH2=TL2=0;
	if(number_input_flag==0)
	{
		if(function1<65)
		{
			++num;
			my_address=HEAD_ADDR+(number-1)*TEAM_LENGTH;
			my_address=my_address+(num-1)*2;
			function1=function1-1;
		
			wren_cmd();
			byte_write(function1,my_address);
		
			++my_address;
			wren_cmd();
			byte_write(function2,my_address);		
		}
	}
	f_dummy();
}
/*
********************************************************************
*
*名称:TASK	f_end_cruise(void)
*功能:*结束设置预置点
*修改参数:sendone,sendthree,sendtwo
* 输入参数:速度值
*输出参数:无
*处理的数据:无
*调用的函数:
		wren_cmd();
		byte_write(function1,my_address);
		f_dummy();

*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/
TASK	f_end_cruise(void)
{
	{
		TH2=TL2=0;
	 	wren_cmd();
		byte_write(num,number);
		num=0;
		number=0;	
	}
}
/*
********************************************************************
*
*名称:TASK	f_call_cruise(void)
*功能:调用巡航队列
*修改参数:无
* 输入参数:无
*输出参数:无
*处理的数据:无
*调用的函数:无
*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/
TASK	f_call_cruise(void)
{
	EA=0;
	TH2=TL2=0;
	load_call_team_flag=1;
	call_team_flag=1;//由主程序来调用
	my_address=HEAD_ADDR+(num-1)*TEAM_LENGTH;
	preset_dot=os_read_lenth(my_address);
	EA=1;
	TF0=0;	TL0=TH0=0;
}
/*
********************************************************************
*
*名称:TASK	f_n_shot_o_ent(void)
*功能:以后扩展留用
*修改参数:无
* 输入参数:无
*输出参数:无
*处理的数据:无
*调用的函数:无
*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/

TASK	f_n_shot_o_ent(void)
{
	sub_sendbyte=1;
}
/*
********************************************************************
*
*名称:TASK	f_set_64_next(void)
*功能:以后扩展留用
*修改参数:无
* 输入参数:无
*输出参数:无
*处理的数据:无
*调用的函数:无
*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/

TASK	f_set_64_next(void)
{
	sub_sendbyte=1;
}
/*
********************************************************************
*
*名称:void    f_stop_code(void)
*功能:停止码
*修改参数:sendone,sendtwo,sendthree
* 输入参数:无
*输出参数:无
*处理的数据:无
*调用的函数:f_clear_flag();
*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/

void    f_stop_code(void)
{
 f_clear_flag();
 sendthree=0xf0;
 sendtwo=0Xf0;//改动如下
}
/*
********************************************************************
*
*名称:void    F1_ON_(void)
*功能:分组码,暂时没有用,留待以后开发用
*修改参数:sendone,sendtwo,sendthree
* 输入参数:无
*输出参数:无
*处理的数据:无
*调用的函数:f_clear_flag();
*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/

void    F1_ON_(void)
{
 sendthree=1;
 sendtwo=0XB5;
}
/*
********************************************************************
*
*名称:void    F1_OFF_(void)
*功能:分组码,暂时没有用,留待以后开发用
*修改参数:sendone,sendtwo,sendthree
* 输入参数:无
*输出参数:无
*处理的数据:无
*调用的函数:f_clear_flag();
*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/

void    F1_OFF_(void)
{
 f_clear_flag();
 sendthree=2;
 sendtwo=0XB5;
}
/*
********************************************************************
*
*名称:void    F2_ON_(void)
*功能:分组码,暂时没有用,留待以后开发用
*修改参数:sendone,sendtwo,sendthree
* 输入参数:无
*输出参数:无
*处理的数据:无
*调用的函数:f_clear_flag();
*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/

void    F2_ON_(void)
{
 	f_clear_flag();
 	sendthree=3;
 	sendtwo=0XB5;
}
/*
********************************************************************
*
*名称:void    F2_OFF_(void)
*功能:分组码,暂时没有用,留待以后开发用
*修改参数:sendone,sendtwo,sendthree
* 输入参数:无
*输出参数:无
*处理的数据:无
*调用的函数:f_clear_flag();
*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/

void    F2_OFF_(void)
{
	 f_clear_flag();
	 sendthree=4;
	 sendtwo=0XB5;
}	
void f_alarm_input()
{
	f_clear_flag();
 	sendthree=function1+64;
 	sendtwo=0X97;

	f_sendbytes();
	f_show_alarm_point( function1);	
	sendtwo=0;
	sendthree=0;
	sendfour=0;

}

/*
********************************************************************
*
*名称:TASK	f_direction_jiebao(void)
*功能:控制电机,镜头等的数据分析
*修改参数:sendone,sendtwo,sendthree
* 输入参数:无
*输出参数:无
*处理的数据:无
*调用的函数:f_clear_flag();
	f_stop_code();
	f_left();
		f_right();
		f_up();
		f_down();
		f_left_up();
		f_left_down();
		f_right_up();
		f_right_down();
		f_far();
		f_near()
		f_close()
		f_open()
		f_tele()
		f_wide()
           	F1_ON_();
         	 F1_OFF_();
        	F2_ON_();
           	F2_OFF_();
		f_F3on();
		f_F3off();
		f_auto_on();
		f_auto_off();
		f_cam_line_on();
		f_cam_line_off();
		f_cam_line();
		f_set_pre();
		f_end_pre();
		f_call_pre();

		f_set_cruise_number();
		f_set_cruise();
		f_end_cruise();
		f_call_cruise();

		f_n_shot_o_ent();
		f_set_64_next();
*创建人:	DaiWei
*创建时间:2003-8-21 10:13
*修改时间:2003-8-21 11:23
********************************************************************
*/
TASK	f_direction_jiebao(void)
{
	switch(function)
	{
		case	0:      test_521_flag=0; _nop_();f_stop_code();	
		limited_max_code=1;//限制最大速度
		break;//停止码
		case	1:	_nop_();f_left();	break;
		case	2:	_nop_();f_right();	break;
		case	4:	_nop_();f_up();	        break;
		case	3:	_nop_();f_down();	break;
		case	6:	_nop_();f_left_up();	break;
		case	5:	_nop_();f_left_down();	break;
		case	8:	_nop_();f_right_up();	break;
		case	7:	_nop_();f_right_down();	break;

		case	9:	_nop_();f_far();	break;
		case 0x0a:	_nop_();f_near();	break;
		case 0x0b:	_nop_();f_close();_nop_();_nop_();	break;
		case 0x0c:	_nop_();f_open(); _nop_();_nop_();      break;
		case 0x0d:	_nop_();f_tele();_nop_();_nop_();	break;
		case 0x0e:	_nop_();f_wide();_nop_();_nop_();	break;

        case    0x0f:   F1_ON_();       break;
        case    0x10:   F1_OFF_();      break;
        case    0x11:   F2_ON_();       break;
        case    0x12:   F2_OFF_();      break;

		case 0x13:	f_F3on();	break;
		case 0x14:	f_F3off();	break;

		case 0x17:	f_auto_on();	break;
		case 0x18: 	f_auto_off();	break;

		case 0x19:	f_cam_line_on();	break;
		case 0x1a:	f_cam_line_off();	break;
		case 0x1b:	f_cam_line();		break;
		case 0x37:	f_set_pre();		break;//设置预制点
		case 0x38:	f_end_pre();		break;
		case 0x39:	f_call_pre();		break;

		case 0x3a:	f_set_cruise_number();		break;
		case 0x3b:	f_set_cruise();		break;
		case 0x3c:	f_end_cruise();		break;
		case 0x3d:	f_call_cruise();	break;

		case 0x3e:	f_n_shot_o_ent();	break;
		case 0x3f:	f_set_64_next();	break;
		case	0x45:	f_alarm_input();sub_sendbyte=1;break;//增加报警输入时间2004-2-14
		default:sub_sendbyte=1;	break;
	}

}
/*
********************************************************
*菜单解码解的码给菜单用
*
*
*
********************************************************
*/

TASK	f_menu_jiebao(void)
{
	f_dummy();
	if(function1==98)
	{
		direction=1;
		f_display_clear();
	}

}
/*
*********************************************************************8
*发送数据
*针对的是方式3接收,方式2发送,9600的波特率,其它的方式可能不是合用
*
*修改时间:2003-5-27 13:59
**********************************************************************
*/
/*
******************************************************************************************
*以下是耐杰码解码部分
*
*******************************************************************************************
*/

uchar	xdata	balance_flag=0;
void	f_balace_of_control()
{
	switch(pe[4])
	{
		case	0x37:	switch(pe[5])
						{
							case	65:balance_flag=1;break;
							case	66:balance_flag=0;pe[4]=0xd1;
										pe[5]=2;break;
							case	68:balance_flag=2;break;
							case	69:balance_flag=0;pe[4]=0xd0;
										pe[5]=2;break;
							default:	break;

						}
						break;
		default:	break;
	}
	switch(balance_flag)
	{
		case	0:	break;
		case	1:	switch(pe[4])
					{
						case	9:pe[4]=0xd0;
										pe[5]=1;break;	
						case	10:pe[4]=0xd0;
										pe[5]=0;break;
						default:	break;
					}
		case	2:switch(pe[4])
					{
						case	9:		pe[4]=0xd1;
										pe[5]=1;break;
						case	10:		pe[4]=0xd1;
										pe[5]=0;break;
						default:	break;
					}
		
		break;
		default:  break;
	}
	switch(pe[4])
	{
		case	1:pe[4]=2;break;
		case	2:pe[4]=1;break;
		case	3:pe[4]=3;break;
		case	4:pe[4]=4;break;
		case	5:pe[4]=7;break;//left_up   right_up
		case	6:pe[4]=8;break;//rightup  left  up
		case	7:pe[4]=5;break;
		case	8:pe[4]=6;break;
		default:break;
	}

}

void	os_anlay_data_all(void)
{
	f_balace_of_control();
	function=pe[4];
	function1=pe[5];
	function2=pe[6];
	recieve_ok=1;
	sendtwo=pe[4];
	sendthree=pe[5];
	sendfour=pe[6];
	//sendbuff[0]=0xf8;
//	sendbuff[1]=sendtwo;
//	sendbuff[2]=sendthree;
//	sendbuff[3]=sendfour;
//	f_jiebao();//调用转换包
	f_sendbytes();//数据发送
}


/*
********************************************************
收取耐杰的数据
*数据格式波特率:9600	起始位1位	结束位1位数据位8位
校验位:无:
*
*创建时间:2003-5-24:16:28
*修改时间:2003-5-27 14:00
*******************************************************
*/
void	os_demo_left(void)
{
	pe[4]=0x01;
	pe[5]=t[5];
}
/*
*********************************************************************************************************
*名称:
*功能:
* 输入参数:无
*输出参数:无
*处理的数据

⌨️ 快捷键说明

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