7 Segmented displays in combination with 74HC595 and 7447 chip.


I want to connect 4x 7 Segmented displays with 2 Shift registers both connected to 2 7447's each. I have done all the connections. But I'm a little stuck on the software part.

So I want to insert a code, 6241 for example. That means 41 should be in one shift register and 62 into the other. With the binary code: B01000001 and B01100010. However, I'm not sure how to generate this code.

Right now I have this:

digitalWrite(latchPin, LOW);
data = shift_1[0];
data = shift_1[1];
digitalWrite(latchPin, HIGH);

Which doesn't work. I don't know the actual theory behind it but I'm guessing arduino enters 4 0's behind it automatically.

I could write down 100 different instances 00,01,02..10,11,12 etc. etc. but I'm curious if there is another way to do this, any suggestions?

Also I can't seem to find any guides using shift registers in combination with 7447's. Is there a reason for that?

Many thanks in advance,


Please check your hardware. Can a HC595 drive two 7447? Without the 7447, do the 595 outputs show the right voltages?

No surprise it doesn't work as it's not even a complete sketch.

Hmm, the hardware should be fine. But I just don't know to make a big byte from 2 seperate bytes.

A byte is 8 bits, by definition.

If you want to combine two bytes into a single 16-bit int, you can do this:

byte MSB = 123;
byte LSB = 45;

int value = ((int)MSB << 8) | LSB;

Whether the cast to int is needed is compiler/hardware specific. Definitely not needed on the ESP8266 but I’ve been burnt before with similar issues on the Arduino so not taking my risks.

Instead you can also do:

byte MSB = 123;
byte LSB = 45;

int value = MSB;
value = (value << 8) | LSB;