Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LED Sure DE-DP004 Flicker issues (using Arduino)

Status
Not open for further replies.

nobertm

New Member
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?
I think its a brightness/DIMM pin issue - but beyond that im really lost


Code:
//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;

//Home Dn
int downButtonPin = 5; 
int lastDownButtonState = 0;

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

//Reset
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);
}

//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);
}




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(150);
  
}
 
Nobody has answered this so this is just a punt .
Try a couple of capacitors in there as these chips are always subject to frequency interference see
**broken link removed**
 
Well april I done told the OP how to fix this on digital-diy forum he wasn't turning off the leds between up dates. But here the fix

Code:
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);
  pinMode(DIMMIN, OUTPUT);
  pinMode(VDIMMIN, OUTPUT); //add this
}
//converts num to the proper 7 segment value and writes to the home display
void displayNum(int num)
{  
  digitalWrite (DIMMIN ,HIGH);  //add this kills the display
  int digit1 = seg_codes[num%10];
  int digit10 = seg_codes[num/10];
  shiftOut(dataPin, clockPin, LSBFIRST, digit1);
  shiftOut(dataPin, clockPin, LSBFIRST, digit10);
digitalWrite (DIMMIN,LOW); //turns display on add this
}

//converts num to the proper 7 segment value and writes to the visitor display
void VdisplayNum(int Vnum)
{
digitalWrite (VDIMMIN ,HIGH);    //kills display   add this 
  int digit1 = seg_codes[Vnum%10];
  int digit10 = seg_codes[Vnum/10];
  shiftOut(VdataPin, VclockPin, LSBFIRST, digit1);
  shiftOut(VdataPin, VclockPin, LSBFIRST, digit10);
digitalWrite (VDIMMIN ,LOW);  //turns display on add this
}
 
be80be it worked - Thanks again. now im trying to do it using 74LS47, 74LS192 and 74LS14 and have 1 digit working, but cant cascade to the second digit. still trying tho! :) thanks again for your help a few weeks back and I'll prob have questions on this setup in a day or so.

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

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 shift register. But in this design they latch whatever is on the internal data line from the shift register to
the outputs with the same CLK signal. Most often giving you garbage! because of the internal delay in the chip. 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 of the CLK
line and THEN transfered to the output register on the trailing edge of the CLK line, giving more that enough time for the chip to have stable data.

This can be done by lifting pin-12 from each of of the 74HC595 and connecting the 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
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top