Điều khiển chữ chay qua lai trên ma trân 8x64. Ngta mới đăt làm vừa xong, nóng hổi lun.
Code dich từ trái sang phải
Code dich từ phải sang trái
Video:
Code dich từ trái sang phải
void Shift_R()
{ //Dich tu trai sang phai
uint i,j;
uchar temp;
for(i=0;i<so_hang;i++)
{temp=Disp_Buff[i][7-led_item]&0x01;
temp<<=7;
Disp_Buff[i][7-led_item]>>=1;
Disp_Temp[i][0]>>=1;
Disp_Temp[i][0]=Disp_Temp[i][0]|temp;
}
for(j=0;j<so_led-1;j++)
for(i=0;i<so_hang;i++)
{Disp_Temp[i][7-j]>>=1;
temp=Disp_Temp[i][6-j]&0x01;
temp<<=7;
Disp_Temp[i][7-j]|=temp;
}
item++;
if(item==8)
{item=0;
led_item++;
if(led_item==8)
{led_item=0;
led_item1++;}
}
if(led_item1==2)
{count++;
Copy_DataCode();
led_item1=0;}
}
{ //Dich tu trai sang phai
uint i,j;
uchar temp;
for(i=0;i<so_hang;i++)
{temp=Disp_Buff[i][7-led_item]&0x01;
temp<<=7;
Disp_Buff[i][7-led_item]>>=1;
Disp_Temp[i][0]>>=1;
Disp_Temp[i][0]=Disp_Temp[i][0]|temp;
}
for(j=0;j<so_led-1;j++)
for(i=0;i<so_hang;i++)
{Disp_Temp[i][7-j]>>=1;
temp=Disp_Temp[i][6-j]&0x01;
temp<<=7;
Disp_Temp[i][7-j]|=temp;
}
item++;
if(item==8)
{item=0;
led_item++;
if(led_item==8)
{led_item=0;
led_item1++;}
}
if(led_item1==2)
{count++;
Copy_DataCode();
led_item1=0;}
}
void Shift_L()
{ //Dich tu phai sang trai
uint i,j;
uchar temp;
for(i=0;i<so_hang;i++)
{temp=Disp_Buff[i][led_item]&0x80;
temp>>=7;
Disp_Buff[i][led_item]<<=1;
Disp_Temp[i][7]<<=1;
Disp_Temp[i][7]=Disp_Temp[i][7]|temp;
}
for(j=0;j<so_led-1;j++)
for(i=0;i<so_hang;i++)
{Disp_Temp[i][j]<<=1;
temp=Disp_Temp[i][j+1]&0x80;
temp>>=7;
Disp_Temp[i][j]|=temp;
}
item++;
if(item==8)
{item=0;
led_item++;
if(led_item==8)
{led_item=0;
led_item1++;}
}
if(led_item1==2)
{count++;
Copy_DataCode();
led_item1=0;}
if(count==6)run1=0;
}
{ //Dich tu phai sang trai
uint i,j;
uchar temp;
for(i=0;i<so_hang;i++)
{temp=Disp_Buff[i][led_item]&0x80;
temp>>=7;
Disp_Buff[i][led_item]<<=1;
Disp_Temp[i][7]<<=1;
Disp_Temp[i][7]=Disp_Temp[i][7]|temp;
}
for(j=0;j<so_led-1;j++)
for(i=0;i<so_hang;i++)
{Disp_Temp[i][j]<<=1;
temp=Disp_Temp[i][j+1]&0x80;
temp>>=7;
Disp_Temp[i][j]|=temp;
}
item++;
if(item==8)
{item=0;
led_item++;
if(led_item==8)
{led_item=0;
led_item1++;}
}
if(led_item1==2)
{count++;
Copy_DataCode();
led_item1=0;}
if(count==6)run1=0;
}