Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;-----------
- Calc ;p-LastP -> if ( p <= LastP[ix] )
- cmpV16ab r23, LastP ;LastP-p -> if ( 0 <= (LastP[ix]-p) )
- bnz TestRise ;p==LastP -> if ( p == LastP[ix] )
- movff16 Timestamp, Corr ; -> Corr[ix]=time
- cmpC16 MinP, r23
- skpnn
- bra CountDet
- bra SetLastP ;;
- TestRise
- bn Rise ;p>LastP -> else
- CountDet
- movf PressureFall, w, a ; -> if ( PMinC[ix] < PressureFall )
- cpfslt PMinC, b
- bra MkDetect ; -> else
- incf PMinC, f, b ; -> PMinC[ix]+=2
- incf PMinC, f, b
- bra SetTMin
- MkDetect
- bsf F_DET ; -> F_DET[ix]=1
- SetTMin
- movff16 Timestamp, TMin ; -> TMin[ix]=time
- bra SetLastP
- Rise
- btfss F_DET ; -> if ( F_DET[ix] )
- bra NDet ; -> else
- bcf F_DET ; -> F_DET[ix]=0
- clrf PMinC, b ; -> PMinC[ix]=0
- btfss P_FIRST ; -> if ( PFirst[ix] )
- bra SetFirst ; -> else
- movf LTMinL, w, b ;tdiff=2*TMin-2*LTMin+LCorr
- subwf TMinL, w, b
- movwf B_PeriodL, b
- movff LTMinH, WREG
- subwfb TMinH, w, b
- movwf B_PeriodH, b
- bcf STATUS, C, a
- btfsc L_CORR
- bsf STATUS, C, a
- rlcf B_PeriodL, f, b
- rlcf B_PeriodH, f, b ;r01=tdiff
- movlw CH_RESET0m
- andwf B_Valve, f, b ;clear old valve
- movf Valve, w, b
- iorwf B_Valve, f, b
- cmpV16bb Corr, TMin ;if ( TMin[ix]==Corr[ix] )
- bnz NCorr ; -> else
- movlw 1 ; -> tdiff--
- subwf B_PeriodL, f, b
- movlw 0
- subwfb B_PeriodH, f, b
- bsf L_CORR ; -> LCorr[ix]=1
- bra CheckMin
- NCorr
- bcf L_CORR ; -> LCorr[ix]=0
- CheckMin
- ;**************
- cmpC16b Tmin, B_Period ; -> if ( tdiff > Tmin )
- bnn NMin
- movlw low Tmin ; -> tdiff=Tmin
- movwf B_PeriodL, b
- movlw high Tmin
- movwf B_PeriodH, b
- NMin
- movff16 B_Period, r01
- movlw 0f0 ; -> PressureFall=int(tdiff/8) /2
- andwf r0, f, a ; r1H r1L r0H r0L -> r1H r1L r0H 00
- swapf r0, f, a ; r1H r1L 00 r0H
- swapf r1, f, a ; r1L r1H 00 r0H
- andwf r1, w, a ; r1L 00 00 r0H r1L->W
- iorwf r0, f, a ; r1L r0H
- movlw PressureFallM ; -> if ( PressureFall < PressureFallMin )
- cpfsgt r0, a ; -> PressureFall=PressureFallMin
- movf r0, w, a
- movwf PressureFall, a
- movff16 TMin, B_PeriodTimestamp
- bra SetLTMin
- SetFirst
- bsf P_FIRST ; -> PFirst[ix]=1
- SetLTMin
- movff16 TMin, LTMin ; -> LTMin[ix]=TMin[ix]
- bra SetLastP
- NDet
- movf PMinC, f, b ; -> if ( PMinC[ix] )
- bz SetLastP
- decf PMinC, f, b ; -> PMinC[ix]--
- SetLastP
- movff16 r23, LastP ; -> LastP[ix]=p
- ;-----------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement