View previous topic :: View next topic |
Author |
Message |
Jerry I
Joined: 14 Sep 2003 Posts: 96 Location: Toronto, Ontario, Canada
|
Re: LED dot matrix blinking... |
Posted: Tue Dec 07, 2004 7:29 am |
|
|
??????. Hi
Can you describe your interface to the 595 and the UCN2004.
Are you displaying all 80 characters at once, or just scrolling the 80 characters on a small matrix. How big a matrix.
do you have the 74hc595's each of the 8 outputs representing a single led (pixel) horizontally , and cascading more 74hc595 to make a display that will display 80 characters.
using 5x7 font.
eg. 80 characters, 6 pixels per character horizontally.
80 x 6 = 480 LED's (pixels) Horizontally
= 480 / 8 outputs of hc595
= 60 74hc595's
I am assuming the each output of the UCN2004 is driving the current for the 8 vertical rows. Scanning one at a time at a high rate.
??
Jerry
ernest wrote: | Hi,
I have built a prototype of 80 columns LED dot matrix display and it is working alright. However, the message (chars.) that are being displayed are not bright enough and the LEDs blink. Why?
How can I solve this problem?
I have tried changing my drive time delay between 600us to 75us but it still doesn't work well.
Sample of my main code is shown below.
Thank You.
ernest
Code: |
delaycount=5; // is this the correct values
while (delaycount)
{
index = startposition;
for (i=0;i<80;i++) // we've 80columns to
{
// store our mask in an array. we need to do this because
// the call to write_expanded_outputs will destroy the value
// passed in.
data[0] = mask[0]; // store which column we are driving
data[1] = mask[1]; // in an array
data[2] = mask[2]; data[3] = mask[3];
data[4] = mask[4]; data[5] = mask[5];
data[6] = mask[6];
data[7]=mask[7]; data[8] = mask[8];
data[9] = mask[9];
(long)index = (long)i + (long)startposition; // point to the next pattern to display
if (index >= ((long)(6*s1_char_size))) ) // ensure that we don't exceed the array
index -= ((long)(6*s1_char_size));
port_d=0;
write_expanded_outputs(data); // enable our column driver
x = s1[index/6];
if((index%6)==0) // if index MODULUS 6 == 0
port_d = 0;
else if( x < 64) // check if s1[] is inside ascii1[] array
{ port_d = ascii1[x-32][(index%6)-1]; }
else if( x > 95) // check if s1[] is inside ascii3[] array
{ port_d = ascii3[x-96][(index%6)-1]; }
else if( x>63 && x<96 ) // check if s1[] is inside ascii2[] array
{ port_d = ascii2[x-64][(index%6)-1]; }
if (shift_left(mask,10,0))
mask[0] = 0x01;
delay_us(100); // WHAT IS THE CORRECT VALUE to control the LED drive time
} // END for-loop
--delaycount; // decrement our delay loop counter
}
++startposition; // Point to the next data pattern
|
| |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Dec 07, 2004 6:24 pm |
|
|
portD controls the rows and the 595's controls the columns. He has 80 columns or 10 - 595's. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Dec 07, 2004 6:30 pm |
|
|
About those columns. Did you look at the signals with the scope? Do they ever get driven? What's the timing on the clock signal look like?
Do a simple test like this
Code: |
for (i=0;i<80;i++) // we've 80columns to
{
port_d=0;
// put the shift register values on the outputs
output_high(EXP_OUT_ENABLE);
output_low(EXP_OUT_ENABLE);
// rotate the 1 through the 595's
output_high(EXP_OUT_CLOCK);
output_low(EXP_OUT_CLOCK);
port_d = 0xFF;
delay_us(50); // adjust this value to control the drive time
} // END for-loop
|
and see if you can get them all to ligt up. |
|
|
ernest
Joined: 11 Feb 2004 Posts: 51
|
|
Posted: Tue Dec 07, 2004 6:46 pm |
|
|
Yes, the columns are fine. From column #1 -- column #80, the blanked output are not fixed to columns but follow the chars instead. For example, the msg that I'm trying to display,
the 2nd column of the char.'W' is blanked all the time even though the char. is scrolled (shifted left) from column #80 to column #1 and back. The same happens to :
- 2nd column of the char.'W' is blanked and resumed with column 3,4,5,6
- 3rd column of char.'l' is blanked and resumed with column 4
- 3rd column of char."t' is blanked and resumed with column 4,5
- 3rd column of char."D"is blanked and resumed with column 4,5,6
It's not that the chars cannot be displayed but one of the column is more like being skipped. So, instead of using 6columns to display ONE char., 7 columns are needed since one of the column (most likely column 2 or 3) is blanked.
I've tested with the test program you recommended. Not all the columns light up. Only the alternate columns light up ie. column 2,4,6,8,10,..,78,80.
Only the even numbered columns light up but the odd numbered columns are blanked.
ernest
Mark wrote: | About those columns. Did you look at the signals with the scope? Do they ever get driven? What's the timing on the clock signal look like?
Do a simple test like this
Code: |
for (i=0;i<80;i++) // we've 80columns to
{
port_d=0;
// put the shift register values on the outputs
output_high(EXP_OUT_ENABLE);
output_low(EXP_OUT_ENABLE);
// rotate the 1 through the 595's
output_high(EXP_OUT_CLOCK);
output_low(EXP_OUT_CLOCK);
port_d = 0xFF;
delay_us(50); // adjust this value to control the drive time
} // END for-loop
|
and see if you can get them all to ligt up. |
|
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Dec 07, 2004 7:13 pm |
|
|
You don't have the RCLK and SRCLK tied together do you? Can you look at the signals with a scope. The RCLK should go high then low and then the SRCLK should go high and then low. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Dec 07, 2004 7:15 pm |
|
|
Just a though, might be a timing issue. Try this
Code: |
for (i=0;i<80;i++) // we've 80columns to
{
port_d=0;
// put the shift register values on the outputs
output_high(EXP_OUT_ENABLE);
output_low(EXP_OUT_ENABLE);
delay_us(2);
// rotate the 1 through the 595's
output_high(EXP_OUT_CLOCK);
output_low(EXP_OUT_CLOCK);
port_d = 0xFF;
delay_us(50); // adjust this value to control the drive time
} // END for-loop
|
|
|
|
ernest
Joined: 11 Feb 2004 Posts: 51
|
|
Posted: Tue Dec 07, 2004 7:32 pm |
|
|
No, RCLK and SRCLK are not tied together. From the scope, the SRCLK(RC1) goes high first & then low and followed by RCLK(RC2) goes high & low.
I also would like to double confirm with you on the pin configurations for the '595 IC.
In my program, I have defined the following:
#define EXP_OUT_ENABLE PIN_C1 // SRCLK
#define EXP_OUT_CLOCK PIN_C2 // RCLK
#define EXP_OUT_DO PIN_C0 // SER
Previously, I have defined it to the following but it can't work:
#define EXP_OUT_ENABLE PIN_C2 // SRCLK
#define EXP_OUT_CLOCK PIN_C1 // RCLK
#define EXP_OUT_DO PIN_C0 // SER
ernest
Mark wrote: | You don't have the RCLK and SRCLK tied together do you? Can you look at the signals with a scope. The RCLK should go high then low and then the SRCLK should go high and then low. |
|
|
|
ernest
Joined: 11 Feb 2004 Posts: 51
|
|
Posted: Tue Dec 07, 2004 7:45 pm |
|
|
Sorry for the confusion just now, my configurations for the '595 are:
#define EXP_OUT_ENABLE PIN_C1 // RCLK ---> Pin 12 of '595
#define EXP_OUT_CLOCK PIN_C2 // SRCLK ---> Pin 11
#define EXP_OUT_DO PIN_C0 // SER ---> Pin 14
I have tried with the 2us delay but it's still the same as the previous one. The LED columns light up alternately.
ernest
Mark wrote: | Just a though, might be a timing issue. Try this
Code: |
for (i=0;i<80;i++) // we've 80columns to
{
port_d=0;
// put the shift register values on the outputs
output_high(EXP_OUT_ENABLE);
output_low(EXP_OUT_ENABLE);
delay_us(2);
// rotate the 1 through the 595's
output_high(EXP_OUT_CLOCK);
output_low(EXP_OUT_CLOCK);
port_d = 0xFF;
delay_us(50); // adjust this value to control the drive time
} // END for-loop
|
|
|
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Dec 07, 2004 7:46 pm |
|
|
Quote: |
#define EXP_OUT_ENABLE PIN_C1 // SRCLK
#define EXP_OUT_CLOCK PIN_C2 // RCLK
#define EXP_OUT_DO PIN_C0 // SER
Previously, I have defined it to the following but it can't work:
#define EXP_OUT_ENABLE PIN_C2 // SRCLK
#define EXP_OUT_CLOCK PIN_C1 // RCLK
|
Something seems a bit strange to me. In the top example you say SRCLK is on C1 while the latter you say it is on C2. Which pin number of the 595 do you have connected to C1 and which one to C2?
What did the delay do for the test program? Once we get this straighten out, I'll show you some more speed improvements. |
|
|
ernest
Joined: 11 Feb 2004 Posts: 51
|
|
Posted: Tue Dec 07, 2004 7:59 pm |
|
|
So sorry for the confusion. I'd like to CONFIRM that I have connected the following way:
#define EXP_OUT_ENABLE PIN_C1 // RCLK ---> Pin 12
#define EXP_OUT_CLOCK PIN_C2 // SRCLK ---> Pin 11
#define EXP_OUT_DO PIN_C0 // SER --> Pin 14
Hence, RC1 connected to RCLK & RC2 connected to SRCLK.
From the scope, the RCLK goes high & then low first and next followed by SRCLK going high & low.
The delay of 2us that you've asked to try out works the same way (in terms of LED display still same ie.alternate ON & blank) as the previous test program without the delay. From scope, I can notice that there is a longer gap/interval between each RCLK pulse and SRCLK pulse due to the delay.
ernest
P/S:
#define EXP_OUT_ENABLE PIN_C1 // RCLK ---> Pin 12
#define EXP_OUT_CLOCK PIN_C2 // SRCLK ---> Pin 11
#define EXP_OUT_DO PIN_C0 // SER --> Pin 14
Mark wrote: | Quote: |
#define EXP_OUT_ENABLE PIN_C1 // SRCLK
#define EXP_OUT_CLOCK PIN_C2 // RCLK
#define EXP_OUT_DO PIN_C0 // SER
Previously, I have defined it to the following but it can't work:
#define EXP_OUT_ENABLE PIN_C2 // SRCLK
#define EXP_OUT_CLOCK PIN_C1 // RCLK
|
Something seems a bit strange to me. In the top example you say SRCLK is on C1 while the latter you say it is on C2. Which pin number of the 595 do you have connected to C1 and which one to C2?
What did the delay do for the test program? |
|
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Dec 07, 2004 7:59 pm |
|
|
Take a look at the columns and measure the pulse time. Measure one that works and then measure one that doesn't. |
|
|
ernest
Joined: 11 Feb 2004 Posts: 51
|
|
Posted: Tue Dec 07, 2004 8:14 pm |
|
|
Observation from scope when measured before 2.2 ohm resistors to the
LED columns.
The one that works (0xFF):
Pulse time = 7us
When no pulse (ie zero) = Float 0.5V from ground ref.
Vpulse = 2V
The one that doesn't (blanks):
Pulse time = 7us
When no pulse (ie zero) = Float 1.37V from ground ref.
Vpulse = 3V
ernest
Mark wrote: | Take a look at the columns and measure the pulse time. Measure one that works and then measure one that doesn't. |
|
|
|
ernest
Joined: 11 Feb 2004 Posts: 51
|
|
Posted: Tue Dec 07, 2004 8:25 pm |
|
|
I've check that again. When measured before 2.2 ohm resistors to the
LED columns, overall it looks like below:
The one that works (0xFF):
Pulse time = nearly 60us
When no pulse (ie zero) = voltage degrades slowly from 1.5 to 0 in 2.5ms
Vpulse = 2V
The one that doesn't (blanks):
Pulse time = about 7us ONLY
When no pulse (ie zero) = overall 0V but with intermittent spikes from switching of other columns
ernest
Mark wrote: | Take a look at the columns and measure the pulse time. Measure one that works and then measure one that doesn't. |
|
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Dec 07, 2004 8:32 pm |
|
|
Now we are getting somewhere. Take a look at a good one again, and on the other channel look at the bad one. What is the time between the 60us pulse going back low and the start of the 7us pulse. |
|
|
ernest
Joined: 11 Feb 2004 Posts: 51
|
|
Posted: Tue Dec 07, 2004 8:58 pm |
|
|
The time between the negative/falling slope (pulse going low) of the 60us pulse and the following rising slope of 7us pulse is
The 60us pulse(column 78) is immediately followed by the 7us pulse(column 79). In fact, the 7us pulse caused the 60us to continue to be triggered high for another 7us.
Immediately after the 60us pulse gone low(column 78), another 60us pulse (column 80) is triggered high. The pulse time for this column is also 60us.
Hence, it seems that once the 60us pulse goes low, the 7us pulse and the next 60us go high immediately but the 7us pulse stays ONLY for 7us but the 60us continues to be high for 60us.
Measurements are taken from column 78(60us pulse) and column 79(7us pulse) and column 80(60us pulse).
ernest
Mark wrote: | Now we are getting somewhere. Take a look at a good one again, and on the other channel look at the bad one. What is the time between the 60us pulse going back low and the start of the 7us pulse. |
|
|
|
|