Go Down

Topic: 8-Digit 7-Segment LED Display Module (Read 5299 times) previous topic - next topic

zparticle

Mar 11, 2014, 03:29 am Last Edit: Mar 11, 2014, 11:54 pm by zparticle Reason: 1
I've been sent this display and I'm having some issues getting it to work.

http://www.icstation.com/product_info.php?products_id=2428#.Ux5gPfmwLYg

With the code below I'm able to write the various digits to the display and control the decimal points.  However it appears that what ever the last digit is that I write to the display fills all of the LEDs.  So if I write 98765432 then 2 is displayed in all of the LEDs.  This thing has no documentation so I'm just trying to figure it out.  It uses two 595 shift registers. Any ideas?

Code: [Select]

#define SER 11 //DATA
#define RCL 12 // LATCH
#define CLK 8 // CLOCK
// 7 segment display with segment/bit encoding of .gfedcba
//   AA
// FF  BB
//   GG
// EE  CC
//   DD  .
// Binary mapping for digits 0 to 9 with decimal point turned off.
// a bit value of 0 turns the segment on, a value of 1 turns it off.
byte numbers[10] = {
 B11000000, B11111001, B10100100,
 B10110000, B10011001, B10010010,
 B10000010, B11111000, B10000000,
 B10010000 };
byte space = B11111111;   // space, all segements off
byte decimal = B10000000; // decimal point on bit
// Positions
byte positions[8]={1, 2, 4, 8, 16, 32, 64, 128};

void setup() {
 //set pins to output so you can control the shift register
 pinMode(RCL, OUTPUT);
 pinMode(CLK, OUTPUT);
 pinMode(SER, OUTPUT);
}

void loop() {
 digitWrite(9, 0, true);
 digitWrite(8, 1, true);
 digitWrite(7, 2, true);
 digitWrite(6, 3, true);
 digitWrite(5, 4, false);
 digitWrite(4, 5, true);
 digitWrite(3, 6, true);
 digitWrite(2, 7, true);

}

void digitWrite(int value, int pos, boolean decimalOn) {
 // turn off the output so the pins don't light up
 // while you're shifting bits:
 digitalWrite(RCL, LOW);

  shiftOut(SER, CLK, MSBFIRST, positions[pos]);
 //shiftOut(SER, CLK, MSBFIRST, pos);
 if(decimalOn)
   shiftOut(SER, CLK, MSBFIRST, numbers[value] ^ decimal);
 else
   shiftOut(SER, CLK, MSBFIRST, numbers[value]);

 // turn on the output so the LEDs can light up:
 digitalWrite(RCL, HIGH);
}

polymorph

Please post the whole part number.

That board uses the 74HC595  8 bit shift register. It only has 8 outputs. There are two on the board, no info I can see on their website, so I'd guess that one addresses the segments, the other individual digits. Cascaded, undoubtedly. So you must multiplex by sending the number -and- which digit it is, then the same for the next digit, and so on.

http://forum.arduino.cc/index.php?topic=139543.0

This seller has a schematic and sample Arduino code:
http://www.robotshop.com/en/serial-8-characters-7-segment-led-display.html

Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

zparticle

Yeah that is what the code is doing, unfortunately it doesn't work. Each write causes all 8 LEDs to display the exact same value.  It appears it makes no difference if I send in a position value or not.  Unless I try to send the position value after the character value in which case if freaks out. Hmmm....

Go Up