Hi,
you should apply a serial resistor(or the bias resistor take between LED & GND) & read back (maybe through a schmitt/"digitalizer" if the voltage isnt full CMOS range) the voltage over their...
K.
For red, yellow or green LED use 3V, for blue 4V ..
If you have a lab power supply with current limit adjust the voltage to 3V and the short-circuit current to max 10mA ..
Ensure that the output of the power supply is floating, i.e. is isolated from your circuit .. Now you can safely test LEDs ..
If you don’t have such a power supply take 2 x 1.5V batteries (=3V) and add a resistor in series .. see attached picture ..
@ IanP: you clearly didn't understand my question.
Let me be more explicit : Let's say I have connected 8 LEDs on PORTB (one LED to one PIN) of a microcontroller. I want to command these LEDs however I want but I want also to test their functionality. So this is my question: How can I test one of these LEDs ?
If you want to see if the LED is broken then you could use a DMM set to "diode check" and see if it open in one direction and some voltage in the other direction.
If you want to see if the LED is broken then you could use a DMM set to "diode check" and see if it open in one direction and some voltage in the other direction.
I think I understand. To be clear you are able to turn the LED on and off as desired but you want to be able to tell if the LED gets damaged somehow.
When I spoke earlier of a DMM I was refering to a Digital Multimeter so that you could test the LED independent of the microcontroller, however thats not what you want.
I would think it is unlikley that the LED will fail due to their long lifespan. Maybe you could set up a current sense resistor and measure the voltage with an ADC. Lets say your PIC output normally drives the output high to turn on the LED you know what the voltage across the resistor is (2v?)and if that voltage gets larger (4v?) then you could enter a routine to do whatever you want.
If you are wanting to test all 8bits you could mutliplex into a single ADC if you dont have 8 ADCs on your PIC.
there is another way how thw LED can be tested without using ADC. That's why I asked how the LED is driven, i.e. High voltage level (LED between I/O pin and GND - sourcing current from uC) or Low voltage level (LED between I/O pin and Vcc - sinking current to uC).
I dont want to steal Squids thread but I am interested in your answer, normally I sink LED's because of the higher current limit. As I am new to the PIC world I am curious what you are suggesting.
Thanks
Sorry squid. I really did not have time to go through all your posts... so writing to your first basic question.... How to test LED's while keeping them connected to the MP or MC, or for that matter any circuit..... right
Its quite simple....
1) Switch off your circuit... completely... If possible take one of the legs of the LED out of the circuit.. If not possible then too its fine.
2) Take an extra battery (9V) which u usually get in market or a nice remote battery. And also take a resistor (compulsorily above 1K Ω).
3) now connect one the battery-LED-Resistor in series. Meaning (Connect positive terminal of the battery to the resistor and the other leg of the resistor to the anode of the LED. and then connect the negative terminal of the battery to the cathode of the LED.)
4) If it glows- good luck for the project. If it does not, then good luck debugging or de-soldering)
*Cathode of LED is the one having shorter leg... of the one having a flat metal nearing it inside the glass..
**It usually happens while soldering that you tend to overheat LED causing failure of LED.. Or In a breadboard connection the connectivity of the breadboard is usually faulty.
*** you can not comment anything on the functionality of the Mu-P/Mu-C coz the circuit making it work was still turned off....