I had written program to blink 8 led's one by one in 8051.it is working fine.

Is possible to indicate if any one of the led goes bad?

I know through multi meter we can check led is good or bad.Is it possible through any other method

  • 1
    \$\begingroup\$ Is 89V1 a typo? I couldn't find any information on it so it might be worth adding a link to the datasheet into the question and updating the title if it is something else. \$\endgroup\$ – PeterJ Oct 11 '14 at 7:26
  • \$\begingroup\$ Your MC has 8 channel ADC. If those pins are not used you can use them to measure voltage on anodes of your leds. \$\endgroup\$ – Alexey Oct 13 '14 at 7:24

I suppose you have connected the LEDs to the outputs of the microcontroller with the common ground.

However if you connect the LEDs with the common voltage supply with cathodes connected to the microcontroller you will be able to detect if the current is flowing through the diode.


simulate this circuit – Schematic created using CircuitLab

When you have the LEDs connected like this you have 2 options for the pin configuration:

  1. Pin configured as the output
    • when you set output to '1' the LED is off
    • when you set output to '0' the LED is on
  2. Pin configures as the input
    • in this configuration you can detect the current flowing through the LED. If there is '1' at the input, the LED is OK.

But you should configure the pin as the input only for LED testing and not to drive the LED. Inputs have high impedance so the current flowing would be low and LED may not turn on.

So if your LED is blinking then you can turn it off and during the off period you may configure the pin as an input and check if the LED is OK. Then configure the pin as an output again and turn the LED on.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.