求大神翻译汇编语言
溪毅 2018-01-24 05:04:21 RSEG DATA16_Z
OUTP DS 2 ; allocate 2 Byte
inp21 DS 2
outp11 DS 2
outp21 DS 2
inp23 DS 2
outp13 DS 2
outp23 DS 2
inp15 DS 2
inp25 DS 2
outp15 DS 2
outp25 DS 2
p11 DS 2
p13 DS 2
p15 DS 2
delay2 DS 2
delay3 DS 2
delay4 DS 2
avg_temp_2 DS 2 ; averaging result n-2
peaks DS 2 ; captures number of peaks
zeros DS 2 ; captures number of zero crossings
integ_total_2 DS 2 ; result integral total signal
integ_HPB DS 2 ; result integral high pass signal
sample_count DS 2 ; captures number of samples
sample_count_2 DS 2
div_count_1 DS 2 ; overflow count if integ_total
div_count_2 DS 2 ; overflow count if integ_HPB
ratio_false DS 2 ; count failure ratio rule
peak_false DS 2 ; count failure peaks rule
zero_false DS 2 ; count failure zero crossing rule
AAF_select DS 2 ; select anti aliasing filter
;-------------------------------------------------------------------------------
; Main
;-------------------------------------------------------------------------------
RSEG CSTACK ; define stack segment
;-------------------------------------------------------------------------------
RSEG CODE ; assemble to Flash memory
;-------------------------------------------------------------------------------
RESET mov.w #SFE(CSTACK),SP ; initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; stop WDT
SetupBC_ call #SetDCO_8Mhz
SetupP1 mov.b #0FFh,&P1DIR ; all P1.x outputs
clr.b &P1OUT ; all P1.x reset
SetupP2 mov.b #0FFh,&P2DIR ; all ports output, P2.0 don't care, P2.2 don't care,
mov.b #BIT0+BIT1+BIT2, &ADC10AE0
; P2.0 OA0I0, P2.1 OA0O (ADC IN)
; P2.2 OA0I1
clr.b &P2OUT ; all P2.x reset
SetupP3 mov.b #0FFh,&P3DIR ; all P3.x outputs
clr.b &P3OUT ; all P3.x reset
SetupP4 mov.b #0FFh,&P4DIR ; all P4.x output, P4.6 don't care, P4.4 don't care
clr.b &P4OUT ; all P4.x reset
mov.w #0, AAF_select ; select AAF, "0" off else "on"
cmp.w #1, AAF_select
jlo no_AAF ; unsigned
SetupADC10
call #SetupADC10_wakeup_AAF
jmp SetupOP0
no_AAF call #SetupADC10_wakeup_no_AAF
SetupOP0 call #SetupOP1_2
SetupTA_ call #SetupTA
call #INITMEM ; clear all variables
bis.w #MC_1, TACTL ; up mode, TA start
mov.b #LPM3+GIE, SR ; enable LPM3 mode and global interrupts
Mainloop jmp Mainloop
;------------------------------------------------------------------------------
TA0_ISR;
;------------------------------------------------------------------------------
bic.w #MC_1, TACTL ; TA stop
bis.b #BIT0, P4OUT ; microphone on
bis.b #BIT4, P2OUT ; offset on
bis.w #OAPM_3,&OA0CTL0_ ; start OP0 fast mode, amplifier
cmp.w #1, AAF_select
jlo cont_4 ; jump if no AAF selected
bis.w #OAPM_3,&OA1CTL0_ ; start OP1 fast mode, start filter
call #delay_8MHz_AAF ; OP settling time
jmp cont_5
cont_4 call #delay_8MHz_no_AAF ; OP settling time
cont_5 bis.w #ADC10ON,&ADC10CTL0
bis.w #ENC+ADC10SC,&ADC10CTL0 ; enable ADC10 + start conversion
wait_IFG bit.w #ADC10IFG, &ADC10CTL0 ; ADC10IFG set?
jz wait_IFG ; jump if ADC10IFG not set
bic.w #ADC10IFG, &ADC10CTL0
mov.w &ADC10MEM, temp1 ; save ADC10MEM to a working register
sub.w #520, temp1 ; subtract 520 because of 520 Offset
cmp.w #trigger_lvl_low, temp1 ; compare trigger level with input level
jl trigger ; temp1 < trigger level?
cmp.w #trigger_lvl_high, temp1; compare trigger level with input level
jge trigger ; temp1 > trigger level?
jmp no_trigger
trigger call #SetDCO_12Mhz
bic.w #ENC, &ADC10CTL0 ; disable ADC10
bit.w #BIT3, &OA1CTL0_
jz cont_9 ; jump if AAF off
call #SetupADC10_cont_AAF ; execute if AAF on
jmp cont_10
cont_9 call #SetupADC10_cont_no_AAF
cont_10 bis.w #ENC+ADC10SC,&ADC10CTL0 ; enable ADC10 + start conversion
bic.b #LPM3, 0(SP) ; disable LPM3 mode
reti
no_trigger
bic.w #OAPM0+OAPM1,&OA0CTL0_ ; OP0 off
bic.w #OAPM0+OAPM1,&OA1CTL0_ ; OP1 off
bic.w #ENC,&ADC10CTL0 ; disable ADC10
bic.w #ADC10ON, &ADC10CTL0 ; ADC10 off
bic.b #BIT0, P4OUT ; microphone off
bic.b #BIT4, P2OUT ; offset off
bis.w #MC_1, TACTL ; up mode, TA start
reti
;------------------------------------------------------------------------------
ADC10_ISR;
;------------------------------------------------------------------------------
mov.w &ADC10MEM, temp1 ; save ADC10MEM to a working register
sub.w #512, temp1 ; subtract 512 because of 512 Offset
inc sample_count
call #signal_analysis
reti
;------------------------------------------------------------------------------
signal_analysis; analysing input signal 60ms = 2336 samples at fs=38961Hz
;------------------------------------------------------------------------------