I'm trying to control a LED using some microcontroller and I designed a circuit using a D-FF and a transistor to handle it. It looks like this:


So I can control when to turn it on or of by simply writting on the data bus as LSB of that is attached to the D pin of the D-FF.

When I reset the circuit the LED turns off successfully and also when I turn it on afterwards.

But, when trying to turn it off when it's already fired up by writting a 0 onto the data bus, it doesn't work and the led it's still turned on.

I hooked up the logic analyzer to ensure what's going and that's exactly what happened, but don't know why. The Q output should be low when writting a 0 and receive a clock pulse:


Any suggestion why the Q output remains on high level after that?


EDIT: How about simply inverting the LED indication and connect it to D-FF /Q output instead of Q?:


  • \$\begingroup\$ Use a resistor (2k ?) between base and emitter of the transistor. \$\endgroup\$
    – Antonio51
    Commented Sep 23, 2023 at 11:58
  • \$\begingroup\$ Showing time on the diagram woukd help heaps. Also, as clock does not reach 0 - what are the levels? \$\endgroup\$
    – Russell McMahon
    Commented Sep 23, 2023 at 12:25
  • \$\begingroup\$ @MarcusMüller I edited main post to update the screenshot of the timing diagram. Clock pulse is 620ns width, so it should be enough to let the DFF latch the input data value, right? That pulse is taken from the write strobe signal (inverted) from the microcontroller \$\endgroup\$ Commented Sep 23, 2023 at 14:21
  • \$\begingroup\$ @Antonio51, thanks I will try it. But what's the basis of doing that? \$\endgroup\$ Commented Sep 23, 2023 at 14:23
  • \$\begingroup\$ @RussellMcMahon I edited the main post to update the timing diagram. Now it shows that the pulse is 620ns width. The clock reach the 0 level. The line below is from another signal (#6) which is at high level at that point. \$\endgroup\$ Commented Sep 23, 2023 at 14:24

1 Answer 1


Here is what you can do (dividing by 2 for example) ...
Choose (my) R1 (> 2k) until you can do it.

enter image description here

  • \$\begingroup\$ I tested it adding a 2k resistor but same results. I edited main question to add another option \$\endgroup\$ Commented Sep 25, 2023 at 11:30
  • \$\begingroup\$ Don't forget the decoupling capacitor ... is it possible that this FF is "out" ? \$\endgroup\$
    – Antonio51
    Commented Sep 25, 2023 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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