www.pudn.com > 图像识别模组源代码eagle_New.rar > Find_Color_Shape.asm


//============================================================= 
//名称:Find_Color_Shape.asm 
//来源:chengjie\ Email:chengjie@sunnorth.com.cn 
//描述:获得颜色和外形并用语音播报 
//日期:2003.11.5 
//============================================================== 
.include	hardware.inc 
.include    eagle3.inc 
 
.external  		_VR_PrevResult 
.external  		_VR_PrevResult_Color 
.external 		_VR_PrevResult_Shape 
.external		_VR_PrevResult_CenterX; 
.external		_VR_PrevResult_CenterY; 
.external		_VR_PrevResult_AreaH; 
.external		_VR_PrevResult_AreaL; 
.code 
		 
 
//=================================================== 
//函数:Find_Color_Shape  
//语法:调用 
//描述:获得物体的颜色和外形并播报 
//参数:无 
//返回:无 
//===================================================	 
.public	_Find_Color_Shape 
_Find_Color_Shape: .proc 
  
	call	F_Find_Color_Shape 
	retf 
	.endp 
	 
.public  F_Find_Color_Shape; 
F_Find_Color_Shape: 
 
	call	F_NormalOperMode      		// 允许地址75选用,地址为75+00选择手动设置 
	call	F_OperMode	 
	call	F_ShapeAnaly				// 允许地址70选用 
	call	F_Clear70E8			 
	call	F_FeatureEngine				// 允许地址74特征寄存器选用    
L_Analysis_Again: 
	call	F_HighAddr74           	 
	r1 = 0x05							// 选择辨别蓝色、红色、绿色、黄色 
	[R_AddrBuffer] = r1 
	r1 = 0x08 
	[R_WriteDataBuffer] = r1			 
	call	F_WriteOper		 
 
	r1 = 0 
	[R_DelayTime] = r1 
L_WaitFor: 
	r1 = [R_DelayTime] 
	cmp 	r1 ,0x42 
	jbe		L_WaitFor 
 
	call	F_GetObjNum				// 读目标数目 
	r1 = [R_SeekFlag]				 
	r1 &= 0x80 
	jnz 	L_Analysis_Again		// 目标数目>8		 
	r1 = [R_SeekFlag]; 
	r1 &= 0xfe; 
	[R_SeekFlag] = r1; 
 
	r1 = 0x00;						// 清变量 
	[R_PreAreaH] = r1; 
	[R_PreColor] = r1; 
	[R_PreShape] = r1; 
	[R_AreaH] =	r1; 
	[R_AreaL] = r1; 
	[R_Color] = r1; 
	[R_Shape] = r1; 
	[R_CenterX] = r1; 
	[R_CenterY] = r1;		 
 
	call	F_GetObjDataOne;		// 获得一个物体的数据 
 
	r1 = [R_Color];					// 存放变量中 
	[_VR_PrevResult_Color] = r1; 
	r1 = [R_Shape]; 
	[_VR_PrevResult_Shape] = r1;		 
	r1 = [R_CenterX] 
	[_VR_PrevResult_CenterX] = r1 
	r1 = [R_CenterY] 
	[_VR_PrevResult_CenterY] = r1 
	r1 = [R_AreaH] 
	[_VR_PrevResult_AreaH] = r1 
	r1 = [R_AreaL] 
	[_VR_PrevResult_AreaL] = r1 
	retf;