During motor operation, the current is continuously monitored by using the Comparator (CMP) peripheral. If the V- is greater than the V+, which is set from the DAC register, the output of the comparator is set to digital high. For every 50 ms, TMR6 ISR checks the comparator output. If the CMP output is set, stopMotor() function is called, disabling all interrupts and CWG peripherals, stopping the motor operation.