Go Down

Topic: shift register to 7 segment (Read 1 time) previous topic - next topic


say I want to use 3 output pins from my arduino (clock,data,latch) to drive 2 shift resisters to 2 standard radioshack 7 segment displays. i have an int value i want displayed on the displays. point me in the right direction.


It's kind of a tossup but my inclination would be to point you toward the 'LEDs and Multiplexing' section although there are several shift register experts that hang around here as well. 

See what happens here, and if you don't get any ideas after a while then try the other section of the forum.




In brief - integer division and modulus. Connect each output from the '595 to one of the segments. Put the character designs into an array then you can simply pull the latch low, output digit[n], output digit[m]. Pull the latch high to display.

But watch the total current you can draw from your shift register. Typically this is around 70mA, and each segement of your display will probably draw 20-30 mA.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield


"2 standard radioshack 7 segment displays" Common anode or common cathode?
You just want to display the highByte on one digit and the lowByte on the other?
Otherwise, you need more digits; 0xFFFF (hex) = 65,535 (decimal).

As hinted above, make an array to define your font being displayed:
byte fontArray[] = {
B00111111, // 0 with 1 = segment on
B00000110, // 1  bit 0 = a, 1 = b, 2 = c, 3 = d, 4 = e, 5 = f, 6 = g, 7 = decimal point if used
B01011011, // 2
// etc. up to 9, and A,b,C,d,E,F for hex display

segment definitions:
f          b
e          c
      d         DP

then send it  out. I prefer SPI for fast transfers. Be sure to include a 0.1uF (100nF) cap from thre Vcc pin to Gnd.

digitalWrite(ssPin, LOW);
SPI.transfer( fontArray [ highByte(yourInt) ] );  // swap these 2 around if needed
SPI.transfer( fontArray [ lowByte(yourInt) ] );
digitalWrite(ssPin, HIGH);

pin10 ssPin, connects to output register clock pin (RCK) on both shift registers
pin 11 MOSI, connect to serial data in pin on one device, its serial data out pin connects to serial data in on the next device
pin 13 SCK, connects to shift register clock pin (SRCK) on both shift registers
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up