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?: