51单片机做的16*16点阵显示汉字的所有资料下载:
点阵.rar
(50.48 KB, 下载次数: 131)
下面是部分程序预览:
- #include <reg51.h>
- #include<intrins.h>
- /* 数据端接口定义 */
- sbit sck = P2^0; //输入时钟
- sbit row_dat = P2^1; //行数据时钟
- sbit row_buf_sck = P2^2; //行锁存
- //sbit row_mr = P2^4; //移位寄存器清零端
- //sbit row_oe = P2^5; //输出使能
- /* 选通端接口定义 */
- sbit col_dat = P2^6; //列数据时钟
- sbit col_buf_sck = P2^3; //列锁存
- unsigned int code sel[16] = {0xff7f,0x7fff,0xffbf,0xbfff,0xffdf,0xdfff,0xffef,0xefff,
- 0xfff7,0xf7ff,0xfffb,0xfbff,0xfffd,0xfdff,0xfffe,0xfeff};
- unsigned char code hanzi[22][32] =
- {
- /* @1 河(16x16,V)@ [suki software]*/
- {0x08,0x20, 0x06,0x20, 0x40,0x7E, 0x31,0x80,
- 0x00,0x00, 0x20,0x00, 0x27,0xF0, 0x24,0x20,
- 0x24,0x20, 0x27,0xF0, 0x20,0x02, 0x20,0x01,
- 0x3F,0xFE, 0x20,0x00, 0x20,0x00, 0x00,0x00},
- /* @2 南(16x16,V)@ [suki software]*/
- {0x20,0x00, 0x27,0xFF, 0x24,0x00, 0x24,0x10,
- 0x26,0x90, 0x25,0x90, 0x24,0x90, 0xFC,0xFE,
- 0x24,0x90, 0x25,0x90, 0x26,0x90, 0x24,0x12,
- 0x24,0x01, 0x27,0xFE, 0x20,0x00, 0x00,0x00},
- /* @3 工(16x16,V)@ [suki software]*/
- {0x00,0x04, 0x20,0x04, 0x20,0x04, 0x20,0x04,
- 0x20,0x04, 0x20,0x04, 0x20,0x04, 0x3F,0xFC,
- 0x20,0x04, 0x20,0x04, 0x20,0x04, 0x20,0x04,
- 0x20,0x04, 0x20,0x04, 0x00,0x04, 0x00,0x00},
- /* @4 业(16x16,V)@ [suki software]*/
- {0x00,0x02, 0x08,0x02, 0x06,0x02, 0x01,0xC2,
- 0x00,0x02, 0xFF,0xFE, 0x00,0x02, 0x00,0x02,
- 0x00,0x02, 0xFF,0xFE, 0x00,0x42, 0x00,0x82,
- 0x03,0x02, 0x0C,0x02, 0x00,0x02, 0x00,0x00},
- /* @5 职(16x16,V)@ [suki software]*/
- {0x40,0x10, 0x40,0x18, 0x7F,0xF0, 0x49,0x10,
- 0x49,0x20, 0x7F,0xFF, 0x40,0x20, 0x40,0x01,
- 0x3F,0xC6, 0x20,0x98, 0x20,0x80, 0x20,0x80,
- 0x20,0x90, 0x3F,0xCC, 0x00,0x03, 0x00,0x00},
- /* @6 业(16x16,V)@ [suki software]*/
- {0x00,0x02, 0x08,0x02, 0x06,0x02, 0x01,0xC2,
- 0x00,0x02, 0xFF,0xFE, 0x00,0x02, 0x00,0x02,
- 0x00,0x02, 0xFF,0xFE, 0x00,0x42, 0x00,0x82,
- 0x03,0x02, 0x0C,0x02, 0x00,0x02, 0x00,0x00},
- /* @7 技(16x16,V)@ [suki software]*/
- {0x08,0x20, 0x08,0x22, 0x08,0x41, 0xFF,0xFE,
- 0x08,0x80, 0x09,0x01, 0x10,0x01, 0x11,0x02,
- 0x11,0xC2, 0x11,0x34, 0xFF,0x08, 0x11,0x14,
- 0x11,0x62, 0x11,0x81, 0x10,0x01, 0x00,0x00},
- /* @8 术(16x16,V)@ [suki software]*/
- {0x00,0x08, 0x08,0x10, 0x08,0x20, 0x08,0x40,
- 0x08,0x80, 0x0B,0x00, 0x0C,0x00, 0xFF,0xFF,
- 0x0C,0x00, 0x0B,0x00, 0x48,0x80, 0x38,0x40,
- 0x08,0x20, 0x08,0x10, 0x00,0x08, 0x00,0x00},
- /* @9 学(16x16,V)@ [suki software]*/
- {0x02,0x20, 0x0C,0x20, 0x88,0x20, 0x69,0x20,
- 0x09,0x20, 0x09,0x22, 0x89,0x21, 0x69,0x7E,
- 0x09,0x60, 0x09,0xA0, 0x19,0x20, 0x28,0x20,
- 0xC8,0x20, 0x0A,0x20, 0x0C,0x20, 0x00,0x00},
- /* @10 院(16x16,V)@ [suki software]*/
- {0x00,0x00, 0x7F,0xFF, 0x44,0x20, 0x5A,0x10,
- 0x61,0xE0, 0x08,0x01, 0x30,0x82, 0x24,0x8C,
- 0x24,0xF0, 0xA4,0x80, 0x64,0x80, 0x24,0xFC,
- 0x24,0x82, 0x28,0x82, 0x30,0x8E, 0x00,0x00},
- /* @11 电(16x16,V)@ [suki software]*/
- {0x00,0x00, 0x00,0x00, 0x1F,0xF8, 0x11,0x10,
- 0x11,0x10, 0x11,0x10, 0x11,0x10, 0xFF,0xFE,
- 0x11,0x11, 0x11,0x11, 0x11,0x11, 0x11,0x11,
- 0x1F,0xF9, 0x00,0x01, 0x00,0x0F, 0x00,0x00},
- /* @12 子(16x16,V)@ [suki software]*/
- {0x01,0x00, 0x41,0x00, 0x41,0x00, 0x41,0x00,
- 0x41,0x00, 0x41,0x02, 0x41,0x01, 0x47,0xFE,
- 0x45,0x00, 0x49,0x00, 0x51,0x00, 0x61,0x00,
- 0x41,0x00, 0x01,0x00, 0x01,0x00, 0x00,0x00},
- /* @13 工(16x16,V)@ [suki software]*/
- {0x00,0x04, 0x20,0x04, 0x20,0x04, 0x20,0x04,
- 0x20,0x04, 0x20,0x04, 0x20,0x04, 0x3F,0xFC,
- 0x20,0x04, 0x20,0x04, 0x20,0x04, 0x20,0x04,
- 0x20,0x04, 0x20,0x04, 0x00,0x04, 0x00,0x00},
- /* @14 程(16x16,V)@ [suki software]*/
- {0x24,0x10, 0x24,0x60, 0x25,0x80, 0x7F,0xFF,
- 0xC4,0x80, 0x44,0x60, 0x00,0x02, 0x7C,0x92,
- 0x44,0x92, 0x44,0x92, 0x44,0xFE, 0x44,0x92,
- 0x44,0x92, 0x7C,0x92, 0x00,0x82, 0x00,0x00},
- /* @15 系(16x16,V)@ [suki software]*/
- {0x00,0x00, 0x00,0x42, 0x44,0x44, 0x4C,0xC8,
- 0x54,0xD0, 0x65,0x42, 0x45,0x41, 0x46,0x7E,
- 0x84,0x40, 0x88,0x40, 0x90,0x50, 0x81,0x48,
- 0x80,0xC4, 0x00,0x62, 0x00,0x00, 0x00,0x00},
- /* @16 计(16x16,V)@ [suki software]*/
- {0x02,0x00, 0x02,0x00, 0x42,0x00, 0x33,0xFE,
- 0x00,0x04, 0x02,0x08, 0x02,0x00, 0x02,0x00,
- 0x02,0x00, 0xFF,0xFF, 0x02,0x00, 0x02,0x00,
- 0x02,0x00, 0x02,0x00, 0x02,0x00, 0x00,0x00},
- /* @17 控(16x16,V)@ [suki software]*/
- {0x08,0x40, 0x08,0x42, 0x08,0x81, 0xFF,0xFE,
- 0x09,0x00, 0x04,0x02, 0x19,0x02, 0x12,0x42,
- 0x14,0x42, 0x90,0x42, 0x70,0x7E, 0x14,0x42,
- 0x12,0x42, 0x15,0x42, 0x18,0x02, 0x00,0x00},
- /* @18 1(16x16,V)@ [suki software]*/
- 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
- 0x00,0x00, 0x08,0x04, 0x08,0x04, 0x1F,0xFC,
- 0x00,0x04, 0x00,0x04, 0x00,0x00, 0x00,0x00,
- 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
- /* @19 2(16x16,V)@ [suki software]*/
- 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
- 0x00,0x00, 0x0E,0x0C, 0x10,0x14, 0x10,0x24,
- 0x10,0x44, 0x11,0x84, 0x0E,0x0C, 0x00,0x00,
- 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
- /* @20 0(16x16,V)@ [suki software]*/
- 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
- 0x00,0x00, 0x07,0xF0, 0x08,0x08, 0x10,0x04,
- 0x10,0x04, 0x08,0x08, 0x07,0xF0, 0x00,0x00,
- 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
- /* @21 1(16x16,V)@ [suki software]*/
- 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
- 0x00,0x00, 0x08,0x04, 0x08,0x04, 0x1F,0xFC,
- 0x00,0x04, 0x00,0x04, 0x00,0x00, 0x00,0x00,
- 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00,
- /* @22 班(16x16,V)@ [suki software]*/
- {0x21,0x08, 0x21,0x0C, 0x3F,0xF8, 0x21,0x10,
- 0x21,0x11, 0x00,0x42, 0x1F,0x84, 0x00,0x18,
- 0xFF,0xE0, 0x00,0x00, 0x21,0x04, 0x21,0x04,
- 0x3F,0xFC, 0x21,0x04, 0x21,0x04, 0x00,0x00},
- };
- void send_data_row(unsigned int dat); /* 发送行数据端数据函数 */
- void send_data_col(unsigned int dat); /* 发送列选通端数据函数 */
- void display(unsigned char *p);
- void delay(unsigned int m);
- void main()
- {
- unsigned char i,j;
- // row_mr = 1;
- // row_oe = 0;
- while(1)
- {
- for(i=0;i<22;i++) //八个代码
- {
- for(j=0;j<15;j++) //循环显示汉字十遍
-
- display(hanzi[i]); //显示一个汉字
- }
- }
- }
- void send_data_row(unsigned int dat)
- {
- unsigned char i;
-
- for(i=0;i<16;i++)
- {
- sck = 0;
- row_dat = dat&0x8000; //temp<<=1;
- dat = dat<<1; //ds = CY;
- sck = 1;
- }
- row_buf_sck = 0;
- _nop_();
- _nop_();
- row_buf_sck = 1;
- }
- void send_data_col(unsigned int dat)
- {
- unsigned char i;
- for(i=0;i<16;i++)
- {
- sck = 0;
- col_dat = dat&0x8000;
- dat = dat<<1;
- sck = 1;
- }
- col_buf_sck = 0;
- _nop_();
- _nop_();
- col_buf_sck = 1;
- }
- void delay(unsigned int m)
- {
- unsigned char i;
- for(;m>0;m--)
- {
- for(i=0;i<124;i++)
- {;}
- }
- }
- void display(unsigned char *p)
- {
- unsigned char i;
- // unsigned int temp;
- for(i=0;i<32;i++)
- {
- if(i<16)
- {
- send_data_row(0x0000);
- // temp = sel[i]|0xff00;
- send_data_col(sel[i]);
- send_data_row(*p);
- p++;
- delay(2);
- }
- else
- {
- send_data_row(0x0000);
- // temp = (sel[i]<<8)|0x00ff;
- send_data_col(sel[i-16]);
- send_data_row((*p)<<8);
- p++;
- delay(2);
- }
- }
- }
复制代码
|