LDS XH,R_nearBlanking ; [近端]
LDS XL,R_nearBlanking+1 ;
MOVW dw41:dw40, XH:XL ; R_nearBlanking
LDI XH, high(D_zoom_dat) ; 采样缩放系数
LDI XL, low(D_zoom_dat) ;
CALL Sub_16MUL_XvsDw40_toX_1035 ; 16bits乘法运算 X*RAM_dw40 => X D_zoom_dat*R_nearBlanking
LDI ZH, high(R_SSPADC_BufArea) ; X-point 起点位置偏移
LDI ZL, low(R_SSPADC_BufArea) ;
ADD XL, ZL ;
ADC XH, ZH ;
MOVW ZH:ZL, XH:XL ; PT-POINT.[dw4B:dw4A]
LD XL, Z ;
LD XH, Z ; max
; 找最大点
_L_lp_fill_start_2009: LD XL, -Z ;
CP XL, XH ;
BRCS _L_lp_fill_0731_1044 ;
MOV XH, XL ;取得最大值
MOVW VarH:VarL, ZH:ZL ;
_L_lp_fill_0731_1044:CLC
CPI ZL, low(R_SSPADC_BufArea) ;
BRNE _L_lp_fill_start_2009 ;
CPI ZH, high(R_SSPADC_BufArea) ;
BRNE _L_lp_fill_start_2009 ;
MOVW ZH:ZL, VarH:VarL
_L_lp_fill_0731_1045:ST -Z, XH
CPI ZL, low(R_SSPADC_BufArea) ;
BRNE _L_lp_fill_0731_1045 ;
CPI ZH, high(R_SSPADC_BufArea) ;
BRNE _L_lp_fill_0731_1045 ;
;
;-----------------------------------;
;-----------------------------------;
LDS XH,R__farBlanking ; [远端]
LDS XL,R__farBlanking+1 ;
MOVW dw41:dw40, XH:XL ;
LDI XH, high(D_zoom_dat) ; 采样缩放系数
LDI XL, low(D_zoom_dat) ;
CALL Sub_16MUL_XvsDw40_toX_1035 ; 16bits乘法运算 X*RAM_dw40 => X
LDI ZH, high(R_SSPADC_BufArea) ; X-point 起点位置偏移
LDI ZL, low(R_SSPADC_BufArea) ;
ADD XL, ZL ;
ADC XH, ZH ;
MOVW dw4F:dw4E, XH:XL ; STOP-POINT.[Dw4F:Dw4E]
;
LDS XH,R_nearBlanking ; [近端]
LDS XL,R_nearBlanking+1 ;
MOVW dw41:dw40, XH:XL ;
LDI XH, high(D_zoom_dat) ; 采样缩放系数
LDI XL, low(D_zoom_dat) ;
CALL Sub_16MUL_XvsDw40_toX_1035 ; 16bits乘法运算 X*RAM_dw40 => X
LDI ZH, high(R_SSPADC_BufArea) ; X-point 起点位置偏移
LDI ZL, low(R_SSPADC_BufArea) ;
ADD XL, ZL ;
ADC XH, ZH ;
MOVW dw4B:dw4A, XH:XL ; PT-POINT.[dw4B:dw4A]
;
MOVW dw4d:dw4c, dw4B:dw4A ; START-POINT.[dw4d:dw4c]
;-----------------------------------------------------
_L_loop_43A4: ; <<<<<<<<<<<<<<<<<<<<==========================
;-----------------------------------------------------
MOVW ZH:ZL,dw4F:dw4E ; STOP-POINT.[Dw4F:Dw4E]
MOVW XH:XL,dw4B:dw4A ; PT-POINT.[dw4B:dw4A] START
CP XL, ZL ;
CPC XH, ZH ;
BRCS _L_cont_1247 ; [***]HGA-07-11
RET ; ****>>>> PT-POINT.[dw4B:dw4A] >= STOP-POINT.[Dw4F:Dw4E]
_L_cont_1247: ;
; -------------------------
; [ 正向-->[to-down] 递减 ]
; -------------------------
_L_loop_fdown_001: MOVW ZH:ZL, dw4B:dw4A ; PT-POINT.[dw4B:dw4A] START
LD XL, Z+ ;
LD XH, Z ;
CLC ;
CP XL, XH ; D[i].vs.D[i+1]
BRCS _L_next_1129_1632 ; =================>> D[i]<D[i+1] 找到最右最低点
; D[i]>=D[i+1]
MOVW XH:XL, dw4F:dw4E ; STOP-POINT.[Dw4F:Dw4E]
CLC ;
CP XL, ZL ; Note: 此时的Z,已经++1
CPC XH, ZH ; STOP-POINT.[Dw4F:Dw4E] <> PT-POINT.[Dw4B:Dw4A]++
BRCS _L_next_1129_1632 ;==>>
; [STOP-POINT.[Dw4F:Dw4E] >= PT-POINT.[Dw4B:Dw4A]+1
MOVW ZH:ZL, dw4B:dw4A ; [dw4B:dw4A]++
ADIW ZH:ZL, 1 ;
MOVW dw4B:dw4A, ZH:ZL ;
JMP _L_loop_fdown_001 ; -loop->
; -------------------------
_L_next_1129_1632: ; [ 正向-->[to-up] 递增 ]
; -------------------------
_L_loop_fup__002: MOVW ZH:ZL, dw4B:dw4A ;
LD XL, Z+ ;
LD XH, Z ;
CLC ;
CP XH, XL ;
BRCS _L_next_1129_43F4 ;==>>
; D[i]=<D[i+1]
MOVW XH:XL, dw4F:dw4E ; STOP-POINT.[Dw4F:Dw4E]
CLC ;
CP XL, ZL ; Note: 此时的Z,已经++1
CPC XH, ZH ; STOP-POINT.[Dw4F:Dw4E] <> PT-POINT.[Dw4B:Dw4A]++
BRCS _L_next_1129_43F4 ;==>>
; [STOP-POINT.[Dw4F:Dw4E] >= F.PT-POINT.[Dw4B:Dw4A]+1
MOVW ZH:ZL, dw4B:dw4A ; [dw4B:dw4A]++
ADIW ZH:ZL, 1 ;
MOVW dw4B:dw4A, ZH:ZL ;
JMP _L_loop_fup__002 ; -loop->
; -----------------------------------------------
_L_next_1129_43F4: ; 找到一个单调上升的正面
; -----------------------------------------------
MOVW dw47:dw46, dw4B:dw4A ; Pt.Back -- -->找到的极点位置
MOVW dw49:dw48, dw4B:dw4A ;
; <<<----------------
_L_loop_43FC: MOVW ZH:ZL, dw47:dw46 ;
LD XL, Z ;
LD XH, -Z ;
CLC ;
CP XL, XH ;
BRCS _L_next_1129_442C ; #==>> ( D[i-1] > D[i] ) 拐点限制
; D[i-1]<D[i].or.D[i-1]=D[i]
MOVW ZH:ZL, dw47:dw46 ; Pt.Back --
LD XL, Z ;
MOVW ZH:ZL, dw49:dw48 ; Pt.fore ++
LD XH, Z ;
CLC ;
CP XL, XH ;
BRCS _L_next_1129_442C ; #==>> ( D[i-1] < D[i] < D[T] )
; #==>> ( D[i-1] = D[i] < D[T] )
; D[i] > D[T] 此处只有在平顶波形是出现
; D[i] = D[T]
MOVW XH:XL, dw49:dw48 ; Pt.fore
MOVW ZH:ZL, dw47:dw46 ; Pt.Back
SUB XL, ZL ;
SBC XH, ZH ;
LDI ZH, high(D_TOP_numF) ; (Pt.fore - Pt.Back) <> D_TOP_num
LDI ZL, low(D_TOP_numF) ;
CLC ;
CP XL, ZL ;
CPC XH, ZH ;
BRGE _L_next_1129_442C ; #==>> ((T-i) >= D_TOP_num) 距离限制
; <
MOVW ZH:ZL, dw4D:dw4C ; START-POINT.[dw4B:dw4A] <> BACK.PT
MOVW XH:XL, dw47:dw46 ;
CLC ;
CP ZL, XL ;
CPC ZH, XH ;
BRCC _L_next_1129_442C ; #==>> ( START-POINT.[dw4B:dw4A] >= BACK.PT ) 边界限制
; <
MOVW ZH:ZL, dw47:dw46 ;
SBIW ZH:ZL, 1 ;
MOVW dw47:dw46, ZH:ZL ; Pt.Back.[dw47:dw46]--1
JMP _L_loop_43FC ; -loop->
;
;<<<<=================================
_L_next_1129_442C: MOVW ZH:ZL, dw49:dw48 ; Pt.fore.[dw49:dw48]
LD XL, Z+ ;
LD XH, Z ;
CLC ;
CP XL, XH ;
BRCS _L_next_445F ; ==>> D[i] < D[i+1] 拐点限制
; D[i]>=D[i+1]
MOVW ZH:ZL, dw49:dw48 ; Pt.fore.[dw49:dw48]
LD XL, Z ;
MOVW ZH:ZL, dw47:dw46 ; Pt.Back.[dw47:dw46]
LD XH, Z ;
CLC ;
CP XL, XH ;
BRCS _L_next_445F ; []==>> D[T] < D[B]
; D[T]>=D[B]
MOVW XH:XL, dw49:dw48 ; (i-B.PT) <> D_TOP_num
MOVW ZH:ZL, dw47:dw46 ;
SUB XL, ZL ;
SBC XH, ZH ;
LDI ZL, high(D_TOP_numB) ;
LDI ZH, low(D_TOP_numB) ;
CLC ;
CP XL, ZL ;
CPC XH, ZH ;
BRGE _L_next_445F ; []==>>
; <
MOVW ZH:ZL, dw4F:dw4E ; STOP-POINT.[Dw4F:Dw4E] <> F.PT-POINT.[dw49:dw48]
MOVW XH:XL, dw49:dw48 ;
CLC ;
CP ZL, XL ;
CPC ZH, XH ;
BREQ _L_next_445F ; []==>>
BRCS _L_next_445F ; []==>>
; >
MOVW ZH:ZL, dw49:dw48 ;
ADIW ZH:ZL, 1 ;
MOVW dw49:dw48, ZH:ZL ; Pt.fore.[dw49:dw48]++1
JMP _L_loop_43FC ; -loop->
;
; ------------------------------------
_L_next_445F: ; 切除峰点
; ------------------------------------
MOVW ZH:ZL, dw47:dw46 ; Pt.Back.[dw47:dw46]
LD XL, Z ;
MOVW ZH:ZL, dw49:dw48 ; Pt.fore.[dw49:dw48]
LD XH, Z ;
CLC ;
CP XL, XH ;
BREQ _L_next_4485 ;
BRCS _L_next_4485 ;
;--------------------------------
; Data---> to[dw49:dw48] if( D.[dw47:dw46] > D.[dw49:dw48] )
;--------------------------------
MOVW ZH:ZL, dw47:dw46 ; dw47:dw46
LD VarL, Z ;
MOVW XH:XL, dw49:dw48 ;
_L_loop_4470: CLC ;
CP XL, ZL ;
CPC XH, ZH ;
BREQ _L_next_449F ;[]
BRCS _L_next_449F ;[]
; [>]
ST Z+, VarL ;
JMP _L_loop_4470 ; -loop->>
;--------------------------------
_L_next_4485: ; [dw47:dw46]fr <---Data if( D.[dw47:dw46] =< D.[dw49:dw48] )
;--------------------------------
MOVW ZH:ZL, dw49:dw48 ; dw49:dw48
LD VarL, Z+ ;
MOVW XH:XL, dw47:dw46 ;
_L_loop_448C: CLC ;
CP XL, ZL ;
CPC XH, ZH ;
BRCC _L_next_449F ;[] dw47:dw46 >= dw49:dw48
; [<]
ST -Z, VarL ;
JMP _L_loop_448C ; -loop->>
;--------------------------------
_L_next_449F: JMP _L_loop_43A4 ;===>>>>>
;--------------------------------
RET
本人不会汇编的,懂汇编的帮忙看看的,说说这个程序的思路的,我用用c写出来 ,谢谢哈
; |