Having trouble controlling 3 Row Seven Segment with 4 shift register 74hc595

i test one transistor with multimeter, and the result is PNP, but for the digits i'm not sure.

sorry my bad, the 7 segment is SM4112 and work common anode

And two LEDs per segment. Do you know what colour the LEDs are? I wonder if a 5V supply will be enough.

The color is RED, yes. i used 9volt supply

zifank:
i used 9volt supply

Used it for what? You could damage components by applying too high a voltage. What kind of 9V supply did you use and what was the result?

the power is POWER SUPPLY Adapter 9V 1A for arduino. and the result is it's brighter than I use under 9volt, the power is not problem right now, but i still confused to get columns and rows.

this my result and the unfinished codes

int latchPin = 10;
int clockPin = 9;
int dataPin = 8;

// digits from the right
const byte digit[10] =      //seven segment digits in bits
{
  B10000001,  // 0
  B11110011,  // 1
  B01001001,  // 2
  B01100001,  // 3
  B00110011,  // 4
  B00100101,  // 5
  B00000101,  // 6
  B11110001,  // 7
  B00000001,  // 8  fix
  B00100001,  // 9
};


void setup()
{
  Serial.begin(9600);
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
}

void loop()
{
  // step through each digit then increment
  // the counter by one, until nine
  for (int j = 0; j < 10; j++) {
    Serial.println(j);
    updateShiftRegister(0, j);
    delay(1000);
  }
}

void updateShiftRegister(int col, int num)
{
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, B00000101);
  shiftOut(dataPin, clockPin, MSBFIRST, digit[num]);
  digitalWrite(latchPin, HIGH);
}

SevenSegment.ino (888 Bytes)

zifank:
the result is it's brighter than I use under 9volt

The only way to supply power to the board is through the connector. The connector supplies power to the 74hc595 chips directly. The maximum voltage of those chips is 6V. By connecting a 9V supply, you may have damaged the chips. If you want my continued help, explain what else you have done that you have not already described. I do not wish to waste my time writing code for a board that is already damaged.

zifank:
this may result and the unfinishing code

Please try to speak better English, I did not understand what you just said. Please post any code correctly, according to form guidelines in the sticky post.

this is the seven segment picture with 9volt,
sorry, I have not explained that 9 volts I share with lcd and other devices.

@paulRB, can you still help me?
if dont bother you, i hope you give me the sample code please.
tell me if you need more information.

Does the code you posted produce the digits shown in your picture? Do the digits change as the code runs?

my code is not working properly, still confused specify the position of digit, and I can not specify the columns and rows of each segment

You keep asking if you are bothering me. It bothers me when you ignore a question that I ask.

Here is some code to try:

int latchPin = 10;
int clockPin = 9;
int dataPin = 8;

// digits from the right
const byte digit[10] =      //seven segment digits in bits
{
  B10000001,  // 0
  B11110011,  // 1
  B01001001,  // 2
  B01100001,  // 3
  B00110011,  // 4
  B00100101,  // 5
  B00000101,  // 6
  B11110001,  // 7
  B00000001,  // 8  fix
  B00100001,  // 9
};

byte displayBuffer[3][6] =    //digit to display in each position
{
  {0, 1, 2, 3, 4, 5},
  {0, 0, 2, 4, 6, 8},
  {0, 1, 3, 5, 7, 9}
};


void setup()
{
  Serial.begin(9600);
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
}

void loop()
{
  updateShiftRegister();
}

void updateShiftRegister()
{
  // "static" variables do not loose their value when the function ends
  static unsigned long lastUpdateTime; // time from millis() when the dispaly was last updated
  static byte column; // the column currently being lit

  if (millis() - lastUpdateTime > 3)  // is it time to light the next column?
  {
    digitalWrite(latchPin, LOW);
    for (byte row = 0; row < 3; row++) // update each row for the current column
    {
      byte d = displayBuffer[row][column]; // get the required digit for this row & column
      shiftOut(dataPin, clockPin, MSBFIRST, digit[d]); // send the segment data for each row
    }
    shiftOut(dataPin, clockPin, MSBFIRST, 1 << column); // send the column enable mask
    digitalWrite(latchPin, HIGH);

    column++; // next time, we will light the next column
    if (column > 5) column = 0;
    lastUpdateTime = millis();
  }
}

It is unlikely that it will work correctly at the first attempt. I do not have your display and cannot test the code. I must rely on you to test it. This means you must be accurate and detailed in your description of any faults. Pictures, even video, may be useful.

forgive me if I made a mistake in this post, ok paul, I will try the example code you provided,
I'm trying to learn and develop this code.
If successful or not successful then I will tell you in this forum.

best regards for you

What was the result of testing my suggested code?

Are you going to post that schematic you received from the vendor? You should explain how the schematic is incorrect.

@paulRB Sorry for the late reply,
I've tried the code you provided, but still not working (later show the picture), the vendor said the scheme was never published because it is still a beta version and say that schematic correct.
I was told to wait for the release version for 2 weeks later.

zifank:
...say that schematic correct.

Remember those transistors that you checked with your meter and found out they were PNP? Where are they on the schematic?!?