Here is the schematics for the question:
I was using the LM311 as a non-inverting comparator without problem.
It works fine and here is the output below:
But if I use it as an inverting comparator, I get the following output below. As you see the output pulses have distorted tips. I circled one of them with orange color.
Is my transformation of the non-inverting comparator to an inverting comparator just by swapping inputs correct? How can I fix those non-flat corners?