×

We are still shipping! However, order processing may take longer than usual and we cannot guarantee same day shipments due to staffing guidelines from the CDC. Please see all COVID-19 updates here. Thank you for your continued support.

Member #964500

Member Since: April 25, 2017

Country: United States

  • Ok, spent longer than it should have taken me, but finally figured out that the demo code had some ints in there, and once you get over 32,767 it'll start to freak out. I've switched it to use longs and everything started working. Here's the code that ended up doing the trick for me:

    /*
     Controlling large 7-segment displays
    
     Arduino pin mapping:
     5 -> LAT (Blue)
     6 -> CLK (Green on the 6-pin cable)
     7 -> SER on the IN side (Yellow)
    
     Power Arduino with 12V and connect to Vin -> 12V (Red)
     5V -> 5V (Orange)
     GND -> GND (Black)
    
    */
    
    //GPIO declarations
    //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    byte segmentLatch = 5;
    byte segmentClock = 6;
    byte segmentData = 7;
    //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    
    void setup()
    {
      Serial.begin(9600);
      Serial.println("Large Digit Driver Example");
    
      pinMode(segmentClock, OUTPUT);
      pinMode(segmentData, OUTPUT);
      pinMode(segmentLatch, OUTPUT);
    
      digitalWrite(segmentClock, LOW);
      digitalWrite(segmentData, LOW);
      digitalWrite(segmentLatch, LOW);
    }
    
    long number = 0;
    
    void loop()
    {
      long num_to_show = number * (long)111111;
      showNumber(num_to_show); //Test pattern
      number++;
      number %= 10; //Reset x after 9
    
      Serial.println(num_to_show); //For debugging
    
      delay(500);
    }
    
    //Takes a number and displays 5 numbers. Displays absolute value (no negatives)
    void showNumber(long number)
    {
      for (byte x = 0 ; x < 6 ; x++)
      {
        int remainder = number % 10;
    
        postNumber(remainder, x==3);
    
        number /= (long)10;
      }
    
      //Latch the current segment data
      digitalWrite(segmentLatch, LOW);
      digitalWrite(segmentLatch, HIGH); //Register moves storage register on the rising edge of RCK
    }
    
    //Given a number, or '-', shifts it out to the display
    void postNumber(byte number, boolean decimal)
    {
      //    -  A
      //   / / F/B
      //    -  G
      //   / / E/C
      //    -. D/DP
    
    #define a  1<<0
    #define b  1<<6
    #define c  1<<5
    #define d  1<<4
    #define e  1<<3
    #define f  1<<1
    #define g  1<<2
    #define dp 1<<7
    
      byte segments;
    
      switch (number)
      {
        case 1: segments = b | c; break;
        case 2: segments = a | b | d | e | g; break;
        case 3: segments = a | b | c | d | g; break;
        case 4: segments = f | g | b | c; break;
        case 5: segments = a | f | g | c | d; break;
        case 6: segments = a | f | g | e | c | d; break;
        case 7: segments = a | b | c; break;
        case 8: segments = a | b | c | d | e | f | g; break;
        case 9: segments = a | b | c | d | f | g; break;
        case 0: segments = a | b | c | d | e | f; break;
        case ' ': segments = 0; break;
        case 'c': segments = g | e | d; break;
        case '-': segments = g; break;
      }
    
      if (decimal) segments |= dp;
    
      //Clock these bits out to the drivers
      for (byte x = 0 ; x < 8 ; x++)
      {
        digitalWrite(segmentClock, LOW);
        digitalWrite(segmentData, segments & 1 << (7 - x));
        digitalWrite(segmentClock, HIGH); //Data transfers to the register on the rising edge of SRCK
      }
    }
    
  • I'm running into a similar problem, I picked up six of these and have been testing adding them one at a time. I can get up to four with no problem (just cycling through all 1's, all 2's, etc), but once I add a 5th, the numbers will freak out once they get to the 3's (and the same thing happens if I add the sixth digit).

    They do all reset back to 0's once the loop hits the modulus limit, and I've tried adding delays before writing the latches, but nothing seems to be working. Anyone have any ideas?

No public wish lists :(