Go Down

Topic: Two 595 Shift Regs, 4+ 7-Segment LED Displays, Artifacting (Read 967 times) previous topic - next topic

Derek_Z10

Apr 26, 2013, 08:26 am Last Edit: Apr 26, 2013, 09:00 am by Derek_Z10 Reason: 1
So I have this Wired Up:


And when trying to display something, the characters don't come out right.  For instance, here I try to display HELO:

Display Config:
//          _6_
//      5 |_4_| 7
//      3 |___| 1 .0
//           2


As you can see  LED 12, LED 34, and LED 31 are not supposed to be lit.

To get more insight, I displayed only one letter at a time and checked the results:


I keep getting these random artifacts chacters.  Would anyone have any insight as to what is causing this and how to stop it?


I am using this code to test the setup before I write my program:  http://arduino.cc/en/Tutorial/ShftOut12
My modifications are:
• setting the baudrate is set to 38400, as anything lower will cause flickering, due to the way I am testing this.  
• Changing the pin out variables names to something I understand better

Code: [Select]

#define DATASER 11 //BIT3 //SER DS Serial data input //White Wire from 595 Pin 14 to: Arduino Pin 11 PB3
#define CLOCKSHCP 12 //BIT4 //_RCLK  Shift register clock pin //Blue Wire from 595 Pin 11 Brown to: Arduino Pin 12 PB4
#define LATCHSTCP 8 //BIT0 //_SRCLK SS Storage register clock pin //Red Wire from 595 Pin 12 to: Arduino Pin8 PB0



To display the letters, I copy and paste this into the serial monitor, many times over and over, to create a long string of numbers.  
Code: [Select]
// H = 1315141711
// E = 2625242322
// L = 353332
// O = 414243454647
// HELO = 131517112625242322353332414243454647

afremont

I don't see any decoupling caps on the ICs.  Put some .1uF caps across the power and gnd pins of the 74x595 chips.
Experience, it's what you get when you were expecting something else.

Derek_Z10

Thanks for your response!  I had experimented with capacitors earlier, starting with .1uF, but couldn't see them having any affect.  I re-added two .1uF mylar caps to the power and gnd pins like so:



But the problem persists. 

afremont

You have /OE tied low permanently?  Pin 8 is the real ground pin so you might consider how the cap is placed.  I stagger them across the top of a chip from power to ground pin.  Is that grounded cap leg on pin 13 (/OE) or 12 (STCP)? 
Experience, it's what you get when you were expecting something else.

Derek_Z10

The grounded caps are from (/OE) to (Vcc).  (/OE) is tied low permanently because I followed the this guide: http://arduino.cc/en/Tutorial/ShiftOut

JavaMan

The value of H has 2 more digits (...14...) than the first part of HELO. Since I don't know what your code does, maybe this is the problem.

// H = 1315141711
// E = 2625242322
// L = 353332
// O = 414243454647   
// HELO = 131517112625242322353332414243454647

Derek_Z10

You're right, that means the middle segment of the H shouldn't be lit when displaying HELO. That segment is also an artifact then.

JavaMan

Quote
I keep getting these random artifacts chacters.


Are you sure they are random? In the photos where you display only one letter at a time, the "artifact" segment number is the same as the letter number. For example, when letter 1 is on, the artifact is segment 1; when letter 2 is on, the artifact is segment 2, and so on. Is this a coincidence?

Derek_Z10

#8
Apr 28, 2013, 12:52 am Last Edit: Apr 28, 2013, 12:55 am by Derek_Z10 Reason: 1
Instead of using the example arduino program, I wrote my own little program to test.  I can now successfully write out HELO.  Using a delay, I've also found that characters need to refresh at about 80HZ to avoid flickering.  

Code: [Select]
#define BIT7          0x80  // 1000 0000
#define BIT6          0x40  // 0100 0000
#define BIT5          0x20  // 0010 0000
#define BIT4          0x10  // 0001 0000
#define BIT3          0x08  // 0000 1000
#define BIT2          0x04  // 0000 0100
#define BIT1          0x02  // 0000 0010
#define BIT0          0x01  // 0000 0001

#define DATASER BIT3 //SER DS Serial data input //White Wire from 595 Pin 14 to: Arduino Pin 11 PB3
#define CLOCKSHCP BIT4 //_RCLK  Shift register clock pin //Blue Wire from 595 Pin 11 Brown to: Arduino Pin 12 PB4
#define LATCHSTCP BIT0 //_SRCLK SS Storage register clock pin //Red Wire from 595 Pin 12 to: Arduino Pin8 PB0

#define PB_PIN (*((uint8_t*)0x23))  
#define PB_DDR (*((uint8_t*)0x24))  
#define PB_DATA (*((uint8_t*)0x25))

void ShiftReg595_init()
{
PB_DDR |= ( LATCHSTCP | DATASER | CLOCKSHCP );
PB_DATA |= ( LATCHSTCP | DATASER | CLOCKSHCP );
}

//    _2_
//  3|_4_|1
//  5|___|7 .8
//           6

int main()
{
ShiftReg595_init();
while(1)
{
shiftDATA( BIT1 , B10111010); // BIT1 is Display 1, Letter H
HardDelay(3);
shiftDATA( BIT2 , B01111100); // BIT2 is Display 2, Letter E
HardDelay(3);
shiftDATA( BIT3 , B00101100); // BIT3 is Display 3, Letter L
HardDelay(3);
shiftDATA( BIT4 , B11101110); // BIT4 is Display 4, Letter O
HardDelay(3);
}
return 0;
}

void shiftDATA( uint8_t display , uint8_t value )
{
uint16_t value16 = ((display << 8) | (value));

PB_DATA &= ~LATCHSTCP;

for (uint8_t i = 0; i <= 16; i++)
{
PB_DATA |= CLOCKSHCP;
WriteData( DATASER , !!(value16 & (1 << (15 - i))));
PB_DATA &= ~CLOCKSHCP;
}

PB_DATA |=  LATCHSTCP;
}

void WriteData( uint8_t mask, uint8_t val )
{
if (val == 0) { PB_DATA &= ~mask; } else { PB_DATA |= mask; }
}

/**********************************************************************************
* Hard Delay Function
*********************************************************************************/
void HardDelay(uint32_t i)
{ //Delay Thousands of a second
volatile uint32_t msecs;
uint16_t N = 499; //469 is accurate  
//499 is accurate with respect to watchdog in room conditions
for ( msecs = 0 ; msecs < i * N ; msecs++ ) {}
return;
}

Go Up