Go Down

Topic: Having trouble controlling 3 Row Seven Segment with 4 shift register 74hc595 (Read 3563 times) previous topic - next topic

zifank

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.

zifank

this my result and the unfinished codes

Code: [Select]
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);
}

PaulRB

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.

PaulRB

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.

zifank

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

PaulRB


zifank

@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.

PaulRB

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

zifank

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

PaulRB

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

PaulRB

Here is some code to try:
Code: [Select]
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.

zifank



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

PaulRB

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.

zifank

@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.

PaulRB

...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?!?

Go Up