Newbie : help needed for 8 digit 7-segment display

Hi,

Just had some stuff delivered.
As I'm trying to work out a timecaptering device for dogsports, i bought a 8 digit 7seg display @ dx.com.

It has 2x 74HC595D ic's on it, and is to be driven by 5 pins (gnd-ICLK?-ICLK?-DIO?-vcc)

the ink on the PCB is not so clear, so i had to gues what tke markings ICLK-ICLK-DIO mean.

the two 595D's are on the backside of the PCB

the pins are like this, and at the other side of the PCB they are repeated (to cascade)
°VCC
°ICLK ???
°ICLK ???
°DIO ???
°GND

I have an AT Mega 2560 ADK, in some samples it's adviced to use pins 12,11,10 for the connection.
When I run the sample, included with the LCDemo lib. nothing happens. Well some digits light up, but the "ARDUINO" text isn't displaying anyway...

What am I doing wrong? Should the double display (2x4) be driven by SPI, or by the pins 12,11,10?
And what pins from the display should be connected to what pins on the Mega?

Thanks,
Yves

ArduinoSingleModule.jpg

So the picture you show shows markings of DIN (data in), LOAD (latches the information once it is shifted in) and CLK (clocks the data in).

I would tend to presume that if the other labelling on the display is the same, you should assume the obviously mis-labelled connections are actually as in the picture you show, and connect them up accordingly.

Hi Paul,

Thanks, will try that first, :slight_smile:
the picture I posted was the only one that looked the most at the model I have.

Thanks,
Yves

Not sure if you have found the documentation on this device (sorry if you have).

I just googled the web address in the image found the product and there was a documentation link. Have not gone through it, but thought I would put it here for you anyway

Hi FlyingWhale,

I checked the link, and it says the display should be capable of SPI, but it's with a different chipset on it.
Mine has 2x 74HC595D ic's on it.
Is there a manner to find out of the SPI capabilities without having the spec sheet?
And if it would be SPI capable, how to connect it to the Mega 2560 ADK?
Should it be pinned on the small header just behind the MCU?, and if so, on what pins?
Of course I'll do some research of my own, but like i menntioned earlier, i'm a total newbee in this matter :blush:

Thanks anyway, i'll try some things later on tomorow.
I will also take a pic of the display, that would make things easier,

Grtz,
Yves

Connections will be exactly the same as it is still SPI. Forget the ICSP header.

Thing is, unless we know the wiring diagram, we just don't know how to program it!

Hi Paul,

Just took a pic of it.
Can't find any wiring diagram for the moment...

I have another question, if it's SPI capable, what's the benifit for me, do I get more pins free that way, is it faster, or does it use less recources?

edit:
could it be the pins are like this on the input side

°VCC => put on 5V
°SCLK => put on PIN10
°RCLK => put on PIN11
°DIO => put on PIN12
°GND => put GND

i tried a bit of pinswapping, but the only thing I get, is funny characters that run over the display from right to left :blush:

i used this demo code:

//We always have to include the library
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn 
 pin 11 is connected to the CLK 
 pin 10 is connected to LOAD 
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,1);

/* we always wait a bit between updates of the display */
unsigned long delaytime=250;

void setup() {
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}


/*
 This method will display the characters for the
 word "Arduino" one after the other on digit 0. 
 */
void writeArduinoOn7Segment() {
  lc.setChar(0,0,'a',false);
  delay(delaytime);
  lc.setRow(0,0,0x05);
  delay(delaytime);
  lc.setChar(0,0,'d',false);
  delay(delaytime);
  lc.setRow(0,0,0x1c);
  delay(delaytime);
  lc.setRow(0,0,B00010000);
  delay(delaytime);
  lc.setRow(0,0,0x15);
  delay(delaytime);
  lc.setRow(0,0,0x1D);
  delay(delaytime);
  lc.clearDisplay(0);
  delay(delaytime);
} 

/*
  This method will scroll all the hexa-decimal
 numbers and letters on the display. You will need at least
 four 7-Segment digits. otherwise it won't really look that good.
 */
void scrollDigits() {
  for(int i=0;i<13;i++) {
    lc.setDigit(0,3,i,false);
    lc.setDigit(0,2,i+1,false);
    lc.setDigit(0,1,i+2,false);
    lc.setDigit(0,0,i+3,false);
    delay(delaytime);
  }
  lc.clearDisplay(0);
  delay(delaytime);
}

void loop() { 
  writeArduinoOn7Segment();
  scrollDigits();
}

Thanks
Yves

IMG_0628[1].JPG

This display from dealXtreme is a pain to program, because it's driven by 2 shift registers and its not SPI capable.

Here you can find a sample code that shows how to utilize this module: http://www.joshluben.com/blog/?p=670

Hi,

Thanks will try this out, i now use some LCD display's but still has the 7-segment in stock, will defenitly try this out

Grtz,
Yves

Hi,

have a look at demo code below, works fine

UPD 8 x 7 Segment Display 3461BS – playground2014

/*
  Modify from Liquid Crystal example
  For 8 x 7 segment module
*/
  
#define LATCH  12  //pin 12 of BBFuino connect to RCK of 8x7segment module 
#define CLOCK  11  //pin 11 of BBFuino connect to SCK of 8x7segment module 
#define DATA   10  //pin 10 of BBFuino connect to DIO of 8x7segment module 
#define LED    13  //LED is connected to pin 13 of Arduino
#define  MultiplexDelay  1  //delay for multiplexing between digit on 8x7segment module
#define LEFT   0  // define the value for left justify
#define RIGHT  1  // define the value for right justify
#define BLANK 11  //array element to make 7segment blank


// array to activate particular digit on the 8x7segment module
// it is the common anode of 7 segment
byte anode[8] = { 0b10000000,  //digit 1 from right
                    0b01000000,  //digit 2 from right
                    0b00100000,  //digit 3 from right
                    0b00010000,  //digit 4 from right
                    0b00001000,  //digit 5 from right
                    0b00000100,  //digit 6 from right
                    0b00000010,  //digit 7 from right
                    0b00000001   //digit 8 from right                                         
                    };

//array for decimal number, it is the cathode, please refer to the datasheet.
//therefore a logic low will activete the particular segment
                    //PGFEDCBA, segment on 7 segment, P is the dot
byte cathode[12] = {0b11000000,  // 0
                    0b11111001,  // 1
                    0b10100100,  // 2
                    0b10110000,  // 3
                    0b10011001,  // 4
                    0b10010010,  // 5
                    0b10000010,  // 6
                    0b11111000,  // 7
                    0b10000000,  // 8
                    0b10010000,  // 9  
                    0b01111111,  //dot                  
                    0b11111111   //blank
                    };     
 
//fucntion to send the serial data out to two 74HC595 serial to parallel shift register and activate the 7 segment.                  
void display8x7segment(byte datapin, byte clockpin, byte latchpin, byte digit, byte number)
{
    digitalWrite(latchpin, LOW);
    shiftOut(datapin, clockpin, MSBFIRST, digit); // clears the right display
    shiftOut(datapin, clockpin, MSBFIRST, number); // clears the left display
    digitalWrite(latchpin, HIGH);  
}

//function to display value on 8x7 segment display according to the justify state
void displayNumber8x7segment(byte justify, unsigned long value)
{

   byte decimal[8] = {0};   
   value = value % 100000000;  //ensure the value is within 8 digits only
   decimal[7] = value / 10000000;  //extract digit 7 from value
   value = value % 10000000;       //extract the rest of 7 digit value
   decimal[6] = value / 1000000;
   value = value % 1000000;
   decimal[5] = value / 100000;
   value = value % 100000;
   decimal[4] = value / 10000;
   value = value % 10000;
   decimal[3] = value / 1000;
   value = value % 1000;
   decimal[2] = value / 100;
   value = value % 100;
   decimal[1] = value / 10;
   decimal[0] = value % 10;
   byte zero = 0;
   if (justify == RIGHT)
   {   
     for(byte e = 8; e > 0 ; e --)
     {
       if(zero == 0)
       {
         if(decimal[e-1] != 0)          
         {
           display8x7segment(DATA, CLOCK, LATCH, anode[e-1], cathode[decimal[e-1]]);
           zero = 1;     
         }
       }
       else display8x7segment(DATA, CLOCK, LATCH, anode[e-1], cathode[decimal[e-1]]);
     
     delay(MultiplexDelay); 
     }
   }
   else  //if justify == left
   { 
     byte d = 0;     
     for(byte e = 8; e > 0; e --)
     {       
       if(zero == 0)
       {
         if(decimal[e-1] != 0)         
         {
           display8x7segment(DATA, CLOCK, LATCH, anode[7], cathode[decimal[e-1]]);
           zero = 1;
           d ++;     
           delay(MultiplexDelay); 
         }
       }
       else 
       {
         display8x7segment(DATA, CLOCK, LATCH, anode[7-d], cathode[decimal[e-1]]);
         d ++;
         delay(MultiplexDelay); 
       }     
       
     }
     
   }
}
 
void setup() {
  pinMode(LATCH, OUTPUT);
  pinMode(CLOCK, OUTPUT);
  pinMode(DATA, OUTPUT);
  pinMode(LED, OUTPUT);
  digitalWrite(LATCH, HIGH);  
  digitalWrite(LED, LOW);  //off LED  
  // set up the LCD's number of columns and rows: 
 
  delay(1000);  //delay for 1 second
  
}

void loop(){ 
  
  //1st demo, 8x7segment will display decimal value from 0 to 9 and dot from 1st digit (most right) until the last digit (most right) 
  for(byte i = 0; i < 8; i++)
  {
    for(byte k = 0; k < 11; k++)
    {
       display8x7segment(DATA, CLOCK, LATCH, anode[i], cathode[k]);  
    
       delay(300);
    }
  }   
  delay(1000);  //delay 1 second
  
  //2nd demo, 8x7segment will display same decimal from 0 to 9 and dot across all 8 digit
  for(byte k = 0; k < 11; k++)
    {     
        display8x7segment(DATA, CLOCK, LATCH, 0xff, cathode[k]);  //activate all digit  
   
        delay(300);    
    }  
  delay(1000);  //delay 1 second
  
  //3rd demo, 8x7segment will display a decimal value increasing like normal counter.
  for (unsigned long value = 0; value < 100000000; value ++)
  {    
     for(byte i = 0; i < 10 ; i ++)
      {
  
      displayNumber8x7segment(RIGHT, value);  //display the value in right justify format    
     }       
  }
  delay(1000);
  
}