Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Why not look at the datasheet?
The datasheet for an LM3339 quad or LM393 dual comparator says that the absolute maximum negative input voltage is -0.3V and that the inputs work properly only between 0V and the supply voltage minus 1.5V.
As some have said, you can not usually do this directly because the input will be driven too far negative.
As Ron pointed out though, you can use a small bias network to get what you want. By biasing with a positive source that you know will ALWAYS be present, you can still do a comparison of levels that go far beyond the input limits on the device itself.
To protect the device, you may use clamping diodes or sometimes you can depend on the input ESD diodes to protect the device if you make sure the input current is NEVER beyond the specs for the comparator ESD diodes.
It'll work so long as the reference voltage, 5v power in this case + the voltage to be compared is more than zero.
In this case 5v + - 4v = 1V so it'll work.
As mentioned take care not to take the voltages on the chips inputs negative, some chips will blow up, a series resistor with the input & protection diode will do the job in most cases.
I agree that a series resistor often solves the problem. Just have to watch the input current then.
Case in point, i was never able to exactly pin down the max current for the ARM Cortex chips. Asked around, even at the company that made them, nobody can specify that.