mesamune80 said:
ericgibbs i had tried your method which is using 680 and 330 it gave me 4.x V for the output to uC but my LED not lit at all. why is the course for this i wonder? not enough current to drive the LED? or what?
Hi mesamune,
The supply to the LM393 is +12V, I am assuming you are using a RED LED. which should have a forward voltage drop of about 2V.
So that leaves about 10V across the 680R and 330R divider, the current thru the divider will be 10V/1010R = 10mA,
so across the 330R there will 0.01*330R= 3.25V + the LED Vfwd = 5.25V.
The LM393 has an open collector output, so as the output transistor in the LM393 is OFF, it will not sink any current and load the divider.
Also the input impedance[resistance] of the PIC input is a fairly high impedance it will not load the divider.
So ALL the current flowing in the resistors 680R and 330R in series will flow thru the LED, as the current is about 10mA
the LED should glow.!
Could you post the diagram with voltages marked at the
top of the 680R, the
junction of the 680R and 330R ,
also the voltage
across the LED.
You must have a fault elsewhere, are you sure that the PIC pin is set as an Input.?
Lets know.
EDIT: checking your figures that gave you +4V.... I suspect that the LED is blown short circuit.
Assume that the LED is blown s/c... so 12V/1010 = 11.8mA... 11.8mA * 680R = 3.9V. [You measure 4V.!]