I am using the KL04 for BLDC motor control. I want more precise control for state changes in my motor. I was thinking of using the comparator for the same. I want to compare a BEMF voltage from a winding of the motor with the supply voltage. I am looking for the instant the BEMF is almost half of the main supply voltage. Ofcourse, the BLDC is supplied almost 10V , I am stepping that down (volt div) and LPF to acceptable levels for Kinetis.
My point, we need to voltages to the comparator. Can i do the following -
1) Keep the reference voltage as say 3.3V or as in this case half of it or any reference value for that matter. Can i tweak the reference voltage and hard code it or should it always be an input via a pin.
2) Supply the BEMF to the other comparator pin.
3) When the BEMF is half of reference trigger an interrupt.
4) I am using a 24 pin Kinetis KL04. Can I use the Vref for the ADC as the reference voltage of the comparator as well.