BLHeli
BLHeli copied to clipboard
Some confusion about demag process
When one commutation is finished,the timer2 counter is set with Wt_ZC_Tout_Start, in order to know whether zero cross check is timeout. But when a new zero cross point checking start,Flags0.DEMAG_DETECTED is set. And if there is a wrong comparator output, in the function comp_read_wrong_extend_timeout,the timeout check counter timer2 is reset as followed:
comp_read_wrong_extend_timeout: clr Flags0.DEMAG_DETECTED ; Clear demag detected flag anl EIE1, #7Fh ; Disable timer 3 interrupts mov TMR3CN0, #00h ; Timer 3 disabled and interrupt flag cleared jnb Flags1.HIGH_RPM, comp_read_wrong_low_rpm ; Branch if not high rpm
mov TMR3L, #00h ; Set timeout to ~1ms IF MCU_48MHZ == 1 mov TMR3H, #0F0h ELSE mov TMR3H, #0F8h ENDIF
As above description, if a wrong comparator out is got when Flags0.DEMAG_DETECTED is set,the timeout check time must be reset.So whether the timeout check time of Wt_ZC_Tout_Start is not need,it's can be directly set as the value of what comp_read_wrong_extend_timeout set.