I am trying to scroll alphabets using one 8x8 led matrix and 74595
but I have a problem in my code
basically I have formed an array for an alphabet representing the binary numbers for each row corresponding to the alphabet.
then I have shifted them and stored them in an another array.
here is my code....
#include <TimerOne.h>
int latchPin = 8; //Pin connected to Pin 12 of 74HC595 (Latch)
int clockPin = 12; //Pin connected to Pin 11 of 74HC595 (Clock)
int dataPin = 11; //Pin connected to Pin 14 of 74HC595 (Data)
byte frame = 0; // variable to store the current frame being displayed
int k=7;
byte _A[13][8],_B[13][8],_C[13][8],_D[13][8],_E[13][8],_F[13][8],_G[13][8],_H[13][8],_I[13][8],_J[13][8],
_K[13][8],_L[13][8],_M[13][8],_N[13][8],_O[13][8],_P[13][8],_Q[13][8],_R[13][8],_S[13][8],
_T[13][8],_U[13][8],_V[13][8],_W[13][8],_X[13][8],_Y[13][8],_Z[13][8];
byte A[8]={56,68,68,68,124,68,68,0};
byte B[8]={120,68,68,120,68,68,120,0};
byte C[8]={56,68,64,64,64,68,56,0};
byte D[8]={120,68,68,68,68,68,120,0};
byte E[8]={124,64,64,120,64,64,124,0};
byte F[8]={124,64,64,120,64,64,64,0};
byte G[8]={56,68,64,64,92,68,56,0};
byte H[8]={68,68,68,124,68,68,68,0};
byte I[8]={124,16,16,16,16,16,124,0};
byte J[8]={4,4,4,4,68,68,56,0};
byte K[8]={68,72,80,96,80,72,68,0};
byte L[8]={64,64,64,64,64,64,124,0};
byte M[8]={68,108,84,84,68,68,68,0};
byte N[8]={68,68,100,84,76,68,68,0};
byte O[8]={56,68,68,68,68,68,56,0};
byte P[8]={120,68,68,120,64,64,64,0};
byte Q[8]={56,68,68,68,84,76,60,0};
byte R[8]={120,68,68,120,80,72,68,0};
byte S[8]={56,68,64,56,4,68,56,0};
byte T[8]={124,16,16,16,16,16,16,0};
byte U[8]={68,68,68,68,68,68,56,0};
byte V[8]={68,68,68,68,68,40,16,0};
byte W[8]={68,68,68,84,84,108,68,0};
byte X[8]={68,68,40,16,40,68,68,0};
byte Y[8]={68,68,68,40,16,16,16,0};
byte Z[8]={124,4,8,16,32,64,124,0};
void setup()
{
pinMode(latchPin, OUTPUT); // set the 3 digital pins to outputs
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
Timer1.initialize(6000); // set a timer of length 10000 microseconds
Timer1.attachInterrupt(screenUpdate); // attach the screenUpdate function
for(int i=0;i<=12;i++)
{
if(i>=0&&i<=7)
{
for(int j=0;j<=7;j++)
{
_A[i][j]=A[j]>>k;
_B[i][j]=B[j]>>k;
_C[i][j]=C[j]>>k;
_D[i][j]=D[j]>>k;
_E[i][j]=E[j]>>k;
_F[i][j]=F[j]>>k;
_G[i][j]=G[j]>>k;
_H[i][j]=H[j]>>k;
_I[i][j]=I[j]>>k;
_J[i][j]=J[j]>>k;
_K[i][j]=K[j]>>k;
_L[i][j]=L[j]>>k;
_M[i][j]=M[j]>>k;
_N[i][j]=N[j]>>k;
_O[i][j]=O[j]>>k;
_P[i][j]=P[j]>>k;
_Q[i][j]=Q[j]>>k;
_R[i][j]=R[j]>>k;
_S[i][j]=S[j]>>k;
_T[i][j]=T[j]>>k;
_U[i][j]=U[j]>>k;
_V[i][j]=V[j]>>k;
_W[i][j]=W[j]>>k;
_X[i][j]=X[j]>>k;
_Y[i][j]=Y[j]>>k;
_Z[i][j]=Z[j]>>k;
}
k--;
if(k<0)
{k=0;}
}
if(i>=8&&i<=12)
{
k++;
for(int j=0;j<=7;j++)
{
_A[i][j]=A[j]<<k;
_B[i][j]=B[j]<<k;
_C[i][j]=C[j]<<k;
_D[i][j]=D[j]<<k;
_E[i][j]=E[j]<<k;
_F[i][j]=F[j]<<k;
_G[i][j]=G[j]<<k;
_H[i][j]=H[j]<<k;
_I[i][j]=I[j]<<k;
_J[i][j]=J[j]<<k;
_K[i][j]=K[j]<<k;
_L[i][j]=L[j]<<k;
_M[i][j]=M[j]<<k;
_N[i][j]=N[j]<<k;
_O[i][j]=O[j]<<k;
_P[i][j]=P[j]<<k;
_Q[i][j]=Q[j]<<k;
_R[i][j]=R[j]<<k;
_S[i][j]=S[j]<<k;
_T[i][j]=T[j]<<k;
_U[i][j]=U[j]<<k;
_V[i][j]=V[j]<<k;
_W[i][j]=W[j]<<k;
_X[i][j]=X[j]<<k;
_Y[i][j]=Y[j]<<k;
_Z[i][j]=Z[j]<<k;
}
}
}
}
void loop() {
if (frame>12) {
frame =0;
}
delay(100);
frame++;
}
void screenUpdate() { // function to display image
byte row = B10000000; // row 1
for (byte k = 0; k < 9; k++) {
digitalWrite(latchPin, LOW);
shiftOut(11,12,LSBFIRST,~_A[frame][k]);
shiftOut(11,12,LSBFIRST,row);
digitalWrite(latchPin, HIGH);
row = row >> 1;
}
}
when I write alphabets from A-Z in for loop written in setup code does not work
but when I write from A-H code works.
even writing "I" after H screws up the code.
please tell me where I am doing wrong