This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CD40147B: CD40147B truth table confusion

Part Number: CD40147B
Other Parts Discussed in Thread: TPS54531, CD4511B, SN74LVC2G32, SN74LVC1G14, SN74AC32

The CD40147's truth table is negative logic where 0 is high and 1 is low (Why is baffling, but that's another question.)  I can accept the negative logic for the INPUTS at face value but am confused with the OUTPUTS.

If a 1 (low) is put on the 9 pin it says the DCBA output is 1  0  0  1  or (with negative logic)  LO  HI  HI  LO.  But if you feed LO  HI  HI  LO to a 4511 BCD to 7-segmwnt decoder it will output the digit 6, not the digit 9.  Do I need inverters between the 40147's BCD outputs and the 4511's BCD inputs?  Seems silly!  Or per chance is the OUTPUT truth table of the 40147 actually positive logic?  In which case a 1 (low) on the 9 pin would output  HI  LO  LO  HI  and the 4511 would display the digit 9.  Can anyone help clear this up?


  • The CD40147B was not designed to drive some display, but for things like keyboard encoding, where the binary result goes to a data bus. And it was indeed common to have active-low data signals (see, e.g., the 74189 SRAM, or inverting drivers like the 74240).

  • Hi Rod,

    This BCD encoder appears to have priority encoding with pin 9 having the highest priority. Highest priority is defined by the low logic stage. So when pin 9 is low, then yes technically you would get a 6 on a normal BCD to 7 segment decoder. Priority encoding is important because otherwise there may be a clash if multiple inputs are high at the same time.

    I am also curious on your application. Why are you encoding and decoding your signal by using the 40147 in line with the 4511?



  • I'm building a multi-voltage power supply, putting out switchable 3V, 9V, 12V and 15V with a TPS54531 regulator.  When I switch to 9V for example I trigger a display to show "9" via a 40147 and a 4511.  I find it terribly odd that a "9" in on the encoder would display a "6" on a LED display.  What application does that?

    Do you assume I need the inverter between the 40147 and the 4511 to get the correct BCD input?

    Thanks for your help.

  • The 40147 and 4511 were not designed to work with each other.

    You can use inverters, or you can replace the 40147/4511 with entirely different logic.

  • Hi Rod,

    I agree with clemens, I think you should be able to use other logic to drive your LED's.

    If you want to post your current circuit I can maybe suggest something.



  • I am building a hobby power supply with 3V, 5V, and 9V using a TPS54531 switching regulator.  I use a DP3T rotary to switch the Vsense of the regulator and also to change input to a LED Display that will light up a 3, 5, or 9.  The original idea was to use a CD40147 10 decimal to BCD encoder to generate the BCD code for 3, 5, or 9 and feed that to a 4511 BCD to 7-segment decoder.  That led to the current dilemma since the 40147 puts out a negative logic BCD.  I cannot find any 10-line to BCD that does not use negative logic; in fact all or of the 147 variety.  Nor can I find any BCD to 7-segment decoder that uses negative logic BCD input.  So I am stuck with inserting an inverter between the 147 and the 4511 which fortunately I am able to fit in the real estate of my PCB.

    I am curious, if you are interested.  the 40147 takes decimal inputs.  If you activate 9 it puts out the BCD for a 6.  If 8 is active it puts out the BCD for a 7.  Any other input puts out an invalid BCD.  I have no idea what application would use such an encoder.  Do you know what the application would be?  There must be something because you sell a bunch of 40147s.

    Thanks for all your help.

  • Have a look at the required inputs of the CD4511B:

    display  D C B A
       3     0 0 1 1
       5     0 1 0 1
       9     1 0 0 1

    You do not need the 10-line to BCD encoder or inverters; you can route the switch outputs directly to the 7-segment decoder (as active-high signals with pulldown resistors).

    Of course, even the CD4511B might be overkill, because only two of the segments need to be switched:

    5 or 9 -> |_| <- 3 or 9

    So just use two PNP transistors and two NOR or AND gates.

    The CD40147B uses negative logic because the data buses it was designed to connect to used negative logic.

  • To keep it simple I abbreviated my circuit description.  I'm really using two TPS54531s, one with a fixed 5V output, the other with a switched 3V, 9V, 12V, and 15V.  The Led display shows 3, 9, 2, and 5 respectively with another display showing 1 when 12V or 15V are selected.  I'll still study your idea.  Thanks.

    And thanks for the info on negative BCD logic.

  • With two CD4511Bs, A1 = NOT 12, B1 = 3 OR 12, C1 = 15, D1 = 9, A2 = 12 OR 15. So this would need 1× SN74LVC1G14 and 1× SN74LVC2G32.

    Without any 7-segment decoders, a = d = g = on, b = 3 OR 9 OR 12, c = NOT 2, e = 2, f = 5 OR 9, b2 = c2 = 2 OR 5. So this would need 1× SN74LVC1G14 and 1× SN74AC32.

  • Just to let you know I took most of your advice.  I kept the 4511 but replaced the 40147 and the hex inverter with four PFETs and 4 diodes to encode the decimal number to the necessary BCD codes.  It is simpler and uses less PCB real estate.  Thanks for all your help.