和大家分享一些16*16点阵资料,用得着的拿去。动态文字,”物联网“ 16x16点阵套件动态一个字一个字显示源程序
电路图下载: 16x16点阵套件资料(动态“物联网”).rar
- #include
- #include
- #define uint unsigned int
- #define uchar unsigned char
- uchar code table[]={0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08};
- /*-- 文字: 物 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- uchar wu[]={0x10,0x80,0x10,0x80,0x50,0x80,0x50,0xFC,0x7D,0x54,0x52,0x54,0x90,0x54,0x10,0x94,
- 0x1C,0x94,0xF1,0x24,0x52,0x24,0x10,0x44,0x10,0x44,0x10,0x84,0x11,0x28,0x10,0x10};
- /*-- 文字: 联 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- uchar lian[]={0x00,0x88,0xFC,0x48,0x48,0x50,0x48,0x00,0x79,0xFC,0x48,0x20,0x48,0x20,0x78,0x20,
- 0x4B,0xFE,0x48,0x20,0x4C,0x50,0x78,0x50,0xC8,0x88,0x08,0x88,0x09,0x04,0x0A,0x02};
- /*-- 文字: 网 --*/
- /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
- uchar wang[]={0x00,0x00,0x7F,0xFC,0x40,0x04,0x40,0x04,0x42,0x14,0x52,0x94,0x4A,0x54,0x44,0x24,
- 0x44,0x24,0x4A,0x54,0x4A,0x54,0x52,0x94,0x61,0x04,0x40,0x04,0x40,0x14,0x40,0x08};
- ***it RCK=P2^0;
- ***it SCK=P2^1;
- ***it Q1=P2^3;
- ***it Q2=P2^2;
- void delay(uint z)
- {
- uint x,y;
- for(x=z;x>0;x--)
- for(y=25;y>0;y--);
- }
- void HC595(uchar *p) //byte是将要传送的8位数
- {
- uchar i,j,a,b;
- uint byte;
- for(j=0;j<8;j++)
- {
- a=~(*p);
- b=~(*(p+1));
- byte=a*256+b;
- for(i=0;i<=15;i++)
- {
- if((byte&0X01)==0X01)
- Q1=1;//端口送1
- else
- Q1=0;//端口送0
- SCK=0;
- SCK=1;//上升沿送数
- byte>>=1;
- }
- P1=table[j];
- RCK=0;
- RCK=1;//上升沿送数
- // delay(3);
- for(i=0;i<=15;i++)
- {
- Q1=1;//端口送1
- SCK=0;
- SCK=1;//上升沿送数
- }
- p+=2;
- }
- for(j=0;j<8;j++)
- {
- a=~(*p);
- b=~(*(p+1));
- byte=a*256+b;
- for(i=0;i<=15;i++)
- {
- if((byte&0X01)==0X01)
- Q2=1;//端口送1
- else
- Q2=0;//端口送0
- SCK=0;
- SCK=1;//上升沿送数
- byte>>=1;
- }
- P1=table[j+8];
- RCK=0;
- RCK=1;//上升沿送数
- // delay(3);
- for(i=0;i<=15;i++)
- {
- Q1=1;//端口送1
- SCK=0;
- SCK=1;//上升沿送数
- }
- p+=2;
- }
- }
- void main()
- {
- uchar x;
- while(1)
- {
- for(x=0;x<100;x++)
- HC595(wu);
- for(x=0;x<100;x++)
- HC595(lian);
- for(x=0;x<100;x++)
- HC595(wang);
- }
- }
|