16*16左移点阵怎么把列扫描换成行扫描
时间:10-02
整理:3721RD
点击:
#include<reg51.h>
#include<74HC595.h>
#define uchar unsigned char
#define uint unsigned int
#define h sizeof(table_H)
//列扫描数组
uchar code table_L[]={0xff,0x7f, 0xff,0xbf, 0xff,0xdf, 0xff,0xef, 0xff,0xf7, 0xff,0xfb, 0xff,0xfd, 0xff,0xfe,
0x7f,0xff, 0xbf,0xff, 0xdf,0xff, 0xef,0xff, 0xf7,0xff, 0xfb,0xff, 0xfd,0xff, 0xfe,0xff};
//字模数组
uchar code table_H[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//uchar code table_H[] = {0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80,
// 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00,
0x04,0x28,0x08,0x24,0x32,0x22,0xC2,0x21,0xC2,0x26,0x34,0x38,0x04,0x04,0x08,0x18,0x30,0xF0,0xC0,0x17,0x60,0x10,0x18,0x10,0x0C,0x14,0x06,0x18,0x04,0x10,0x00,0x00,
0x02,0x02,0x04,0x82,0xF8,0x73,0x04,0x20,0x02,0x00,0xE2,0x3F,0x42,0x20,0x82,0x40,0x02,0x40,0xFA,0x3F,0x02,0x20,0x42,0x20,0x22,0x20,0xC2,0x3F,0x02,0x00,0x00,0x00,
0x00,0x01,0x04,0x02,0x1C,0x0C,0xC0,0x3F,
0x1C,0xC0,0x02,0x09,0x02,0x16,0x92,0x60,
0x4A,0x20,0x82,0x2F,0x02,0x20,0x0E,0x24,
0x00,0x22,0x90,0x31,0x0C,0x20,0x00,0x00,/*"您",2*/
0x00,0x00,0x0E,0xFC,0xEA,0x08,0xAA,0x08,
0xAA,0xE8,0xAA,0xA8,0xAC,0xA8,0xAA,0xA8,
0xAA,0xA8,0xAA,0xA8,0xEA,0xE8,0xAA,0xA8,
0x0C,0x08,0x08,0x08,0x08,0x28,0x08,0x10,
0x04,0x80,0x0E,0xA0,0x78,0x90,0x08,0x90,0x08,0x84,0xFF,0xFE,0x08,0x80,0x08,0x90,
0x0A,0x90,0x0C,0x60,0x18,0x40,0x68,0xA0,0x09,0x20,0x0A,0x14,0x28,0x14,0x10,0x0C,
};
uchar L=0,H=0;
uint t=0,x=0;
void main()
{
// extern uint h;
EA=1;
ET0=1;
TMOD=0x01;
TH0=(65536-1000)/256;//1ms进一次中断刷新显示一列
TL0=(65536-1000)%256;
TR0=1;
// h=sizeof(table_H);
while(1)
{
if(L==32)
{
L=0;
H=0;
}
}
}
void T0_time() interrupt 1
{
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
Input(table_L[L]);
Input(table_L[L+1]);
Input(table_H[H+x]);
Input(table_H[H+x+1]);
Output();
L=L+2;
if(L==32)L=0;
H=H+2;
if(H==32)H=0;
t++;
if(t==100)//移动
{
t=0;
x=x+2;
if(x>=h-32)x=0;
}
}
#include<74HC595.h>
#define uchar unsigned char
#define uint unsigned int
#define h sizeof(table_H)
//列扫描数组
uchar code table_L[]={0xff,0x7f, 0xff,0xbf, 0xff,0xdf, 0xff,0xef, 0xff,0xf7, 0xff,0xfb, 0xff,0xfd, 0xff,0xfe,
0x7f,0xff, 0xbf,0xff, 0xdf,0xff, 0xef,0xff, 0xf7,0xff, 0xfb,0xff, 0xfd,0xff, 0xfe,0xff};
//字模数组
uchar code table_H[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//uchar code table_H[] = {0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80,
// 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00,
0x04,0x28,0x08,0x24,0x32,0x22,0xC2,0x21,0xC2,0x26,0x34,0x38,0x04,0x04,0x08,0x18,0x30,0xF0,0xC0,0x17,0x60,0x10,0x18,0x10,0x0C,0x14,0x06,0x18,0x04,0x10,0x00,0x00,
0x02,0x02,0x04,0x82,0xF8,0x73,0x04,0x20,0x02,0x00,0xE2,0x3F,0x42,0x20,0x82,0x40,0x02,0x40,0xFA,0x3F,0x02,0x20,0x42,0x20,0x22,0x20,0xC2,0x3F,0x02,0x00,0x00,0x00,
0x00,0x01,0x04,0x02,0x1C,0x0C,0xC0,0x3F,
0x1C,0xC0,0x02,0x09,0x02,0x16,0x92,0x60,
0x4A,0x20,0x82,0x2F,0x02,0x20,0x0E,0x24,
0x00,0x22,0x90,0x31,0x0C,0x20,0x00,0x00,/*"您",2*/
0x00,0x00,0x0E,0xFC,0xEA,0x08,0xAA,0x08,
0xAA,0xE8,0xAA,0xA8,0xAC,0xA8,0xAA,0xA8,
0xAA,0xA8,0xAA,0xA8,0xEA,0xE8,0xAA,0xA8,
0x0C,0x08,0x08,0x08,0x08,0x28,0x08,0x10,
0x04,0x80,0x0E,0xA0,0x78,0x90,0x08,0x90,0x08,0x84,0xFF,0xFE,0x08,0x80,0x08,0x90,
0x0A,0x90,0x0C,0x60,0x18,0x40,0x68,0xA0,0x09,0x20,0x0A,0x14,0x28,0x14,0x10,0x0C,
};
uchar L=0,H=0;
uint t=0,x=0;
void main()
{
// extern uint h;
EA=1;
ET0=1;
TMOD=0x01;
TH0=(65536-1000)/256;//1ms进一次中断刷新显示一列
TL0=(65536-1000)%256;
TR0=1;
// h=sizeof(table_H);
while(1)
{
if(L==32)
{
L=0;
H=0;
}
}
}
void T0_time() interrupt 1
{
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
Input(table_L[L]);
Input(table_L[L+1]);
Input(table_H[H+x]);
Input(table_H[H+x+1]);
Output();
L=L+2;
if(L==32)L=0;
H=H+2;
if(H==32)H=0;
t++;
if(t==100)//移动
{
t=0;
x=x+2;
if(x>=h-32)x=0;
}
}
//SCK上升沿读取数据(由高位送数据),RCK上升沿输出锁存数据 。没有严格的时间要求
sbit SI=P3^4;//数据口
sbit SCK=P3^6;//数据输入时钟线
sbit RCK=P3^5;//数据输出时钟线
void Input(unsigned char dat)
{
char i;
for(i=0;i<8;i++)
{
dat=dat>>1;
SCK=1;
SI=CY;//取出最高位
SCK=0;//上升沿
}
}
void Output()
{
RCK=0;
RCK=1;
RCK=0;//上升沿输出锁存数据
}
求大神帮忙啊