Go Down

Topic: LED Sure DE-DP004 Flicker issues (Read 2 times) previous topic - next topic

blinkerfluid

Apr 26, 2013, 08:49 pm Last Edit: Apr 26, 2013, 08:57 pm by blinkerfluid Reason: 1
Hi all -

Im making a scoreboard and have 2 - 2 digit LED Displays from sure.  The code works great - up down for both and reset.  the problem im having is the non lit segments flicker madly at all times.  I know the displays are not the problem as they don't flicker on the demo driver board.

attached is the code - please advise?

Code: [Select]

//define clock and data pins
int clockPin = 12;
int dataPin = 11;
int VclockPin = 9;
int VdataPin = 8;


//copy and paste for every button
//Home Up
int upButtonPin = 4;
int lastUpButtonState = 0;

//Visitor Up
int VupButtonPin = 7;
int VlastUpButtonState = 0;



//copy and paste for every button
//Home Dn
int downButtonPin = 5;
int lastDownButtonState = 0;

//Visitor Dn
int VdownButtonPin = 3;
int VlastDownButtonState = 0;

//copy and paste for every button
int resetButtonPin = 6;
int lastResetButtonState = 0;

//The number to be displayed on the home display
int displayedNumber = 0;

//The number to be displayed on the visitor display
int VdisplayedNumber = 0;


//the values that must be written out to the shift registers
byte seg_codes[] = { 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b };

//converts num to the proper 7 segment value and writes to the home display
void displayNum(int num)
{
  int digit1 = seg_codes[num%10];
  int digit10 = seg_codes[num/10];
  shiftOut(dataPin, clockPin, LSBFIRST, digit1);
  shiftOut(dataPin, clockPin, LSBFIRST, digit10);
}

void VdisplayNum(int Vnum)
{
  int digit1 = seg_codes[Vnum%10];
  int digit10 = seg_codes[Vnum/10];
  shiftOut(VdataPin, VclockPin, LSBFIRST, digit1);
  shiftOut(VdataPin, VclockPin, LSBFIRST, digit10);
}




void setup()
{
 
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(upButtonPin, INPUT);
  pinMode(downButtonPin, INPUT);
  pinMode(VclockPin, OUTPUT);
  pinMode(VdataPin, OUTPUT);
  pinMode(VupButtonPin, INPUT);
  pinMode(VdownButtonPin, INPUT);
 
}

void loop()
{
//if Home up button pressed
  int upButtonState = digitalRead(upButtonPin);
  if(lastUpButtonState == 0 && upButtonState == 1)
  {
if(displayedNumber < 99)
{
displayedNumber++;
}
else
{
displayedNumber = 0;
}
  }
  lastUpButtonState = upButtonState;
 
  //if Visitor up button pressed
  int VupButtonState = digitalRead(VupButtonPin);
  if(VlastUpButtonState == 0 && VupButtonState == 1)
  {
if(VdisplayedNumber < 99)
{
VdisplayedNumber++;
}
else
{
VdisplayedNumber = 0;
}
  }
  VlastUpButtonState = VupButtonState;

//if down button pressed
  int downButtonState = digitalRead(downButtonPin);
  if(lastDownButtonState == 0 && downButtonState == 1)
  {
if(displayedNumber > 0)
{
displayedNumber--;
}
else
{
displayedNumber = 99;
}
  }
  lastDownButtonState = downButtonState;
 
  //if down button pressed
  int VdownButtonState = digitalRead(VdownButtonPin);
  if(VlastDownButtonState == 0 && VdownButtonState == 1)
  {
if(VdisplayedNumber > 0)
{
VdisplayedNumber--;
}
else
{
VdisplayedNumber = 99;
}
  }
  VlastDownButtonState = VdownButtonState;
 
 

//if reset button pressed
  int resetButtonState = digitalRead(resetButtonPin);
  if(lastResetButtonState == 0 && resetButtonState == 1)
  {
    displayedNumber = 0;
    VdisplayedNumber = 0;
  }
  lastResetButtonState = resetButtonState;

  displayNum(displayedNumber);
  VdisplayNum(VdisplayedNumber);
  delay(100);
 
}


KirAsh4

Please edit your post and put your code inside of [ code ] tags.  Highlight all of your code and click on the '#" icon above.


KirAsh4

So what's the difference in hardware between the demo driver board and whatever you're using to drive them now?  Are the pieces properly grounded?  Do you have the proper pull-up/pull-downs on the signal lines?  There's just too many questions here.

blinkerfluid

no idea whats in the Driver board - it came with the LED board.  I believe grounding is correct.  What is  pull-up/pull-downs on the signal lines?




KirAsh4

I'm assuming you read through this: http://www.sure-electronics.net/mcu,display/DE-DP004.pdf and followed their directions, yes?

Going through your code, I'm only seeing the DATA_IN and CLK_IN defined.  Where are you actually enabling the displays, which should be done with the DIMM_IN pin?

blinkerfluid

KirAsh4

Im not sure - I had help coding this about a year ago and recently pulled it out of mothballs.   any direction would be appreciated

KirAsh4

Start by reading that PDF I linked.

blinkerfluid

I did - twice- its all greek to me.  I do pc repairs and am trying to do this for a relatives backyard.  What am I missing in my code? 

blinkerfluid

Fairly certain the displays are written in here:
Where do I control the DIMM Pin?

Code: [Select]
//converts num to the proper 7 segment value and writes to the home display
void displayNum(int num)
{
  int digit1 = seg_codes[num%10];
  int digit10 = seg_codes[num/10];
  shiftOut(dataPin, clockPin, LSBFIRST, digit1);
  shiftOut(dataPin, clockPin, LSBFIRST, digit10);
}

//converts num to the proper 7 segment value and writes to the visitor display
void VdisplayNum(int Vnum)
{
  int digit1 = seg_codes[Vnum%10];
  int digit10 = seg_codes[Vnum/10];
  shiftOut(VdataPin, VclockPin, LSBFIRST, digit1);
  shiftOut(VdataPin, VclockPin, LSBFIRST, digit10);
}


blinkerfluid

still working on this to no avail - I added to the code for the DIMMIN Pin on the board and hooked it up, but have no idea how it code it to use it...  Please help?

lafleur

#14
Sep 21, 2013, 09:29 pm Last Edit: Sep 22, 2013, 06:44 pm by lafleur Reason: 1
The Sure DE-DP004, 4in, the DE-DP003 2.3in and some of the older DE-DP007 use a 74HC595 shift register to clock serial the data into the display.
(The newer DE-DP007 use a 74HC164 that does not have this problem)

But the design by Sure is flawed. They use the CLK line to drive BOTH the SHCP (Pin-11) Shift clock in and STCP (Pin-12) Output latch enable.

Both of these signals are clock on a positive (rising) going edge of the CLK line, but the 74HC595 has a propagation delay of 25-65ns to transfer the data from
data in, SI (Pin-14) to data out of the internal shift register. But in this design they latch whatever is on the internal data lines from the shift register to
the outputs register at the same time with the same CLK signal. Most often, because of the internal delay not being met in the chip, its giving you garbage, or data from the LAST shift! Not good!

There is a fix for this. It requires clocking the STCP (pin-12) Output latch enable on the opposite state of the CLK line. This can be done by inverting the
CLK line and connected it to STCP (pin-12) Output latch enable.  What happen with this fix, is that the data is shifted in on the leading edge or rising edge of the CLK
line and THEN transfered to the output register on the trailing edge on falling edge of the CLK line, giving more that enough time for the chip to have stable data in the shift register.

This can be done by lifting pin-12 from each of of the 74HC595 and connecting Pin-12 to pin 3, 4 or 5 on the 74HC00 on the board. This chip has CLK on pins-1 and 2
with its inverted signal on pin-3 that is also connected to pin-4 and 5.

fixing this resolved my problems with these boards.... Good luck!

tom at lafleur dot us

Go Up