7-Segment Display Wiring and Programming

G needs to go to ground, that is the active low output enable.
SRCLR needs to be high, it clears the input register when it is low.
SRCK shifts in the 8 bits.
RCK clocks the 8 bits into the output register to control your segments.

So there is no Latch pin - the functionality is different, you need an edge to clock the register.

Right, I switched those somehow. The code you mentioned had a latch pin, so I don't think it will work.

So I send in the 8 bits through SRCK? I thought that was what SER IN did. I can try writing some code once I figure out what information each input needs sent.

Sorry this is taking so long. I appreciate your help. I was sent this site:

and I tried to use that but it seems to be about the other shift register configuration that uses a latch pin. Both shift registers are 595s though.

You'll need something like this:

shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.

where shiftdatapin connects to SER IN,
shiftclockpin connects to SRCK.
MSBFIRST says bit 7 of your data is going out first,
and shiftregdata is your segment data (bit 0-7 representing segments A-G & DP for example).
595 has lots if variations. Need to read the datasheets and wire accordingly.

Wow that works great! Thanks!

Do you know how I could get the code to interpret numbers into bytes that needs to be sent?

int shiftdatapin = 48;
int shiftclockpin = 50;
int RCK = 52;

byte numbers[10] =
{
  B00111111, // 0
  B00000110, // 1
  B01010011, // 2
  B01001111, // 3
  B01100110, // 4
  B01101101, // 5
  B01111101, // 6
  B00000111, // 7
  B01111111, // 8
  B01101111  // 9
};

void setup() {
  //set pins to output so you can control the shift register
  pinMode(shiftdatapin, OUTPUT);
  pinMode(shiftclockpin, OUTPUT);
  pinMode(RCK, OUTPUT);
}

void loop() {
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, B01111111); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.

}

The above code works, but I'd like to be able to put a variable into the code instead of B01111111.

Would the above code work for multiple digits too? For example, could I send 1493 to a string of 4 digits of the display and it'd work or do I have to somehow separate 1493 into individual numbers and send them out?

Easy question first : 1493. Do you have 4 shift registers connected together, so that the output of one feeds the input of 2, two's output feeds 3's input, etc?
If so, you can just do 4 shiftouts in a row. If not, do 4 shiftouts to the individually controlled registers. Shiftout is a software feature, pretty similar to:
digitalWrite (pin, bit0);
digitalWrite (clock low);
digitalWrite (clock, high);
//repeat 7 times for bit1, bit2, ...bit7.
You can also do a hardware controlled shiftout that would go faster using SPI, but you have to use specific pins for it. Go do some reading about it.

shiftregdata = byte1;
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.
shiftregdata =  byte2;
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.
shiftregdata  = byte3;
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.
shiftregdata  = byte4;
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.

now, making bytex= numbers[x], maybe something like this:
shiftregdata[1] = numbers[ones_seconds];
shiftregdata[2] = numbers[tens_seconds];
shiftregdata[3] = numbers[ones_hours];
shiftregdata[4] = numbers[tens_hours];

and the 4 shifts above could be pulled into a loop? Defined as:
for (initialization; condition; increment) {
//statement(s);
}

This loop should do 4 shiftouts, fancier than anything I've tried yet:

//for (x=1 to 4)
for (x=0;  x<5; x=x+1;){  //maybe x==4, and x++ instead x=x+1?? x=x+1 is clearer (to me). Try it.
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata[x]); // load input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // load output register.
//Serial.writeln shiftregdata[x];  // to make sure
}

I have 4 in a row, but the second data input seems to just overwrite the first.

int shiftdatapin = 48;
int shiftclockpin = 50;
int RCK = 52;
int shiftregdata;

byte numbers[10] =
{
  B00111111, // 0
  B00000110, // 1
  B01010011, // 2
  B01001111, // 3
  B01100110, // 4
  B01101101, // 5
  B01111101, // 6
  B00000111, // 7
  B01111111, // 8
  B01101111  // 9
};

void setup() {
  //set pins to output so you can control the shift register
  pinMode(shiftdatapin, OUTPUT);
  pinMode(shiftclockpin, OUTPUT);
  pinMode(RCK, OUTPUT);
}

void loop() {
shiftregdata =  B00000111;
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.
shiftregdata =  B00000111;
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.

}
int shiftdatapin = 48;
int shiftclockpin = 50;
int RCK = 52;
int shiftregdata;

byte numbers[10] =
{
  B00111111, // 0
  B00000110, // 1
  B01010011, // 2
  B01001111, // 3
  B01100110, // 4
  B01101101, // 5
  B01111101, // 6
  B00000111, // 7
  B01111111, // 8
  B01101111  // 9
};

void setup() {
  //set pins to output so you can control the shift register
  pinMode(shiftdatapin, OUTPUT);
  pinMode(shiftclockpin, OUTPUT);
  pinMode(RCK, OUTPUT);
}

void loop() {
shiftregdata =  B11111111;
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.
shiftregdata =  B00000110;
shiftOut(shiftdatapin, shiftclockpin, MSBFIRST, shiftregdata); // puts the bits into the input register
digitalWrite (RCK, LOW);
digitalWrite (RCK, HIGH); // puts the bits into the output register.

}

Well actually the first number just shows up on both

Added a delay and got that sorted out actually.

Right now the only thing left I have to figure out is this. Say the Arduino does some calculations and comes up with the number (int) 2,590, how would I send that to the display?

Won't I somehow have to separate each place (ones, tens, hundreds, etc.) into a single number and convert that to bytes? How can I convert say 3 into B01001111.

This didn't seem to work:

byte numbers[10] =
{
  B00111111, // 0
  B00000110, // 1
  B01010011, // 2
  B01001111, // 3
  B01100110, // 4
  B01101101, // 5
  B01111101, // 6
  B00000111, // 7
  B01111111, // 8
  B01101111  // 9
};

I'm also interested in controlling decimal points.

Where'd you put the delay to make it work?

Decimal point - use the 8th bit to drive the DP.

I do things like this to turn the bit Hi & Low:
Say you have databyte B11111111
To make the 8th bit Low, AND it with 0:
databtye = databute && B01111111
The other bits that are ANDed with 1 are not changed from their original state (0 AND 1 = 0, 1 AND 1 = 1)

To make it back high, OR it with a 1:
databyte = databyte || B10000000
The other bits that are ORed with 0 are not changed (0 OR 0 = 0, 1 OR 1 = 1)

Your other question: I need to know more what a number like 2,593 is.
Are those 4 hex digits?
There are ways to separate it into digits.
For example, hex data digit = 2593:
digit0 = digit AND 0x000F now digit0 = 0003
digit1 = digit >>4 now digit 1 = 0259 (shifted 4 bits away)
digit1 = digit1 AND 0x000F now digit1 = 0009
digit2 = digit1 >>4 now digit2 = 0025
digit2 = digits AND 0x000F now digit2 = 0005
digit3 = digit2 >>4 now digit3 = 0002

Then dataout = numbers[digit0] should give the 7-segment mapping you want for a 3.

So I guess Yes, you have to split it into bytes.

the 2,593 would be an int(eger) stored in a variable

I get how to control the decimal points, but I just wanted to make sure that when the integer was converted into bytes the decimal was kept.

I put the delay at the end. The code I was running didn't have anything else in it, so as soon as it finished sending say 68 it was sending another 8 through that got rid of the 6.

Okay, so split it up & send it out.

How do I split it and how do I keep the decimal?

I presented a way to do that earlier:

"Your other question: I need to know more what a number like 2,593 is.
Are those 4 hex digits?
There are ways to separate it into digits.
For example, hex data digit = 2593:
digit0 = digit AND 0x000F now digit0 = 0003
digit1 = digit >>4 now digit 1 = 0259 (shifted 4 bits away)
digit1 = digit1 AND 0x000F now digit1 = 0009
digit2 = digit1 >>4 now digit2 = 0025
digit2 = digits AND 0x000F now digit2 = 0005
digit3 = digit2 >>4 now digit3 = 0002"

Try this:
digit = 0x2593;

digit0 = digit && 0x000F; // mask off the upper 12 bits
Serial.print (digito, HEX);
digit1 = digit >>4; // shift off the lower 4 bits
digit1 = digit1 && 0x000F; // mask off the upper 12 bits
Serial.print (digit1, HEX);
digit2 = digit >> 8; // shift off the lower 8 bits
digit2 = digit2 && 0x000F; // mask off the upper 12 bits
Serial.print (digit2, HEX);
digit3 = digit >> 12; // shift off the lower 12 bits
digit3 = digit3 && 0x000F; // mask off the upper 12 bits
Serial.print (digit3, HEX);

I don't know where the decimal point goes, not enough info provided.

Those would be int numbers not hex, but did you provide a conversion from into to hex in the beginning of the code? If so, then that should work.

The thing is I want to display a calculated number stored in a variable.

So say
x= 36.3
or
x=2.58

Ideally I'd like to be able to convert x into something to send to the 7-segment displays.

Non-ideally I'd like to get the decimal between the last 2 digits. (234.5 for example)

Thanks for your help man.

So what do the "two 7-segment displays of 4 digits each" represent?