View previous topic :: View next topic |
Author |
Message |
arrow
Joined: 17 May 2005 Posts: 213
|
LED Dot Matrix Problems |
Posted: Mon Nov 21, 2005 6:46 am |
|
|
Hi
I would like to display characters on a 3 (or more) 5x7 led dot matrices.
I am using the 74HCT595 chips (2 of them). And things are ok, but I have two problems:
(a) the numbers flicker- If I try to remove the delay_ms lines what happens is that the first column of the led matrix gets wrapped around to the last column, and each column is shifted by 1
(b) although i am connecting the led matrix directly to 5V with no resistors, the brightness of the leds is very very low. As expected the more dots that light up per column the dimmer is the display.
Can someone please help me with these two probelms?
Thank you in advance, and I include the code below.
Regards
a.
Code: |
#include <16F84a.H>
#fuses LP,NOWDT
#use delay(clock=3000000)
//#use rs232(baud=9600, xmit=PIN_A0, rcv=PIN_A1,RESTART_WDT,ERRORS,INVERT)
#define SH_CLOCK PIN_A0
#define STROBE PIN_A1
#define DATA PIN_A2
#define nUnits 3
#define nColsPerUnit 5
#define nCols nUnits*nColsPerUnit
//int nCols;
//=============================
#define INTS_PER_SEC 183
int seconds,minutes;
int int_count;
//=============================
#byte port_b=6
//=============================
#int_rtcc
void clock(){
int_count++;
if(int_count>=INTS_PER_SEC){
seconds++;
if(seconds>=60){
seconds=0;
minutes++;
}
int_count=0;
}
}
//=============================
void write_expanded_outputs(int dat) {
int i;
output_low(STROBE);
output_high(STROBE);
for(i=0;i<nCols;i++) {
if(i==dat)
output_high(DATA);
else
output_low(DATA);
output_high(SH_CLOCK);
output_low(SH_CLOCK);
}
output_low(STROBE);
output_high(STROBE);
}
//=============================
main(){
//***P array
int P[10][5];
// int str[nUnits];
int mask;
int i,j;
//-------------------------
set_tris_b(0);
port_b = 0;
output_high(STROBE);
//-------------------------
// nCols = nColsPerUnit*nUnits;
//-------------------------
//***Load up P array
P[0][0] = P[0][4] = 65;
P[0][1] = P[0][2] = P[0][3] = 62;
P[1][0] = P[1][4] = 127;
P[1][1] = 94;
P[1][2] = 0;
P[1][3] = 126;
P[2][0] = 0B1011000;
P[2][1] = 0B0110110;
P[2][2] = 0B0110110;
P[2][3] = 0B0110110;
P[2][4] = 0B1001110;
P[3][0] = 93;
P[3][1] = 62;
P[3][2] = 54;
P[3][3] = 54;
P[3][4] = 73;
P[4][0] = 0B1110011;
P[4][1] = 0B1101011;
P[4][2] = 0B1011011;
P[4][3] = 0B0000000;
P[4][4] = 0B1111011;
P[5][0] = 0B0001101;
P[5][1] = 0B0101110;
P[5][2] = 0B0101110;
P[5][3] = 0B0101110;
P[5][4] = 0B0110001;
P[6][0] = 0B1100001;
P[6][1] = 0B1010110;
P[6][2] = 0B0110110;
P[6][3] = 0B0110110;
P[6][4] = 0B1111001;
P[7][0] = 0B0111111;
P[7][1] = 0B0111000;
P[7][2] = 0B0110111;
P[7][3] = 0B0101111;
P[7][4] = 0B0011111;
P[8][0] = 0B1001001;
P[8][1] = 0B0110110;
P[8][2] = 0B0110110;
P[8][3] = 0B0110110;
P[8][4] = 0B1001001;
P[9][0] = 0B1001111;
P[9][1] = 0B0110110;
P[9][2] = 0B0110110;
P[9][3] = 0B0110101;
P[9][4] = 0B1000011;
//-------------------------
seconds = 0;
minutes = 0;
int_count=0;
set_rtcc(0);
setup_counters(RTCC_INTERNAL,RTCC_DIV_16);
enable_interrupts(RTCC_ZERO);
enable_interrupts(GLOBAL);
//-------------------------
while(1){
for(j=0;j<nColsPerUnit;j++){
port_b = P[minutes][j];
mask = j;
write_expanded_outputs(mask);
delay_ms(5);
}
for(j=0;j<nColsPerUnit;j++){
port_b = P[seconds/10][j];
mask = 5+j;
write_expanded_outputs(mask);
delay_ms(5);
}
for(j=0;j<nColsPerUnit;j++){
port_b = P[seconds%10][j];
mask = 10+j;
write_expanded_outputs(mask);
delay_ms(5);
}
}
}
|
|
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Mon Nov 21, 2005 9:31 am |
|
|
With regard to brightness. My 595 spec says 20mA per output. That isn't very much. That is why you are getting away without using a current limiting resistor. Try ordering a TPIC6C595. It works like a high power 595. It has 250mA pulsed per output. I use this chip all the time. Also remember to add that current limiting resistor.
http://rocky.digikey.com/WebLib/Texas%20Instruments/Web%20data/tpic6c595.pdf |
|
|
arrow
Joined: 17 May 2005 Posts: 213
|
|
Posted: Tue Nov 22, 2005 4:52 am |
|
|
Hi Treitmey
Thank you for your suggestion.
However I cannot source those chips from here.
Would you have any other suggestions/ part replacements?
I have been trying to use the 4066 connected to the 5V rail, but what that seems to produce is to light up the entire column. Which is really confusing me.
Do you think the 4066 connected to the 5V rail can be made to work to power the LEDS?
Regards
a. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Tue Nov 22, 2005 9:18 am |
|
|
I'm sorry, but I havn't used that chip.
And since I don't have your circuit, I can't help.
It's unusual that you can't find a source for the STPIC6C595
digikey,mouser,newarkinone all have them |
|
|
|