我已经找到了电调的程序原来程序里的事
; test rcpulse interval
cbr flags2, (1<<RC_INTERVAL_OK) ; preset to not ok
lds i_temp3, stop_rcpuls_l
sub i_temp1, i_temp3
lds i_temp3, stop_rcpuls_h
sbc i_temp2, i_temp3
cpi i_temp1, low (25000)
ldi i_temp3, high(25000) ; 这里低电平时最长时间约是25ms
cpc i_temp2, i_temp3
brsh extint1_fail ; through away
cpi i_temp1, low (15000)
ldi i_temp3, high(15000) ; 这里低电平时最短时间大约是15ms
cpc i_temp2, i_temp3
brlo extint1_fail ; through away
sbr flags2, (1<<RC_INTERVAL_OK) ; set to rc impuls value is ok !
rjmp extint1_exit
; save impuls length
sts new_rcpuls_l, i_temp1
sts new_rcpuls_h, i_temp2
cpi i_temp1, low (2200)
ldi i_temp3, high(2200) ; 这里高电平时最长时间约是2.2ms
cpc i_temp2, i_temp3
brsh extint1_fail ; through away
cpi i_temp1, low (800)
ldi i_temp3, high(800) ; 这里高电平时最短时间约是0.8ms
cpc i_temp2, i_temp3
brlo extint1_fail ; through away
sbr flags1, (1<<RC_PULS_UPDATED) ; set to rc impuls value is ok !
mov i_temp1, rcpuls_timeout
cpi i_temp1, RCP_TOT
breq extint1_exit
inc rcpuls_timeout
; enable int1 again - also entry for spike detect |