搜索文档
知识点
- 低列高行,高行强推
实物
共阴(文字朝上)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|
| H6 | H3 | L4 | H1 | L6 | L7 | H2 | H4 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| H8 | L5 | L3 | H5 | L8 | H7 | L2 | L1 |
共阴(文字朝下)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|
| L8 | L7 | H2 | L1 | H4 | L6 | L4 | H1 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| H5 | H7 | L2 | L3 | H8 | L5 | H6 | H3 |
16*16 瞬间展字
c
#include <REGX52.H>
typedef unsigned int UI;
typedef unsigned char UC;
/**
* 软延时
* @param i 毫秒
*/
void timer(UI i) {
UC j;
while (i--) for (j = 90; j > 0; j--);
}
// 初始化
void init(void) {
P0 = P1 = 0x00;
P2 = 0xF0;
}
// 点阵屏底层驱动
void dzpDisplay(UC * top,UC * bot) {
static UC i = 0;
P0 = top[i];
P1 = bot[i];
timer(2);
P0 = P1 = 0x00;
i = ++i % 16;
P2 += 0x01;
if (P2 == 0x10) P2 = 0x00;
}
// 入口
void main(void) {
UC code pos[] = {
0x00,0x00,0x00,0x40,0x41,0x7F,0x7F,0x41,0x41,0x41,0x7F,0xFF,0x41,0x01,0x03,0x01,0x00,0x10,0x10,0x10,0x10,0x90,0x10,0x10,0x10,0x10,0x32,0x12,0x07,0xFE,0xF8,0x00,
0x00,0x00,0x10,0x22,0x2B,0x6F,0x6A,0xFE,0xBE,0xEA,0x6E,0x6B,0x23,0x31,0x20,0x00,0x00,0x41,0x8B,0xC9,0xFF,0x7F,0xC9,0x8B,0x41,0x8B,0xC9,0x7F,0x7F,0xC9,0x8B,0x41,
0x00,0x00,0xFF,0x44,0xFF,0x00,0xFF,0x44,0xFF,0x10,0xEF,0xDF,0x51,0x4B,0x7D,0x01,0x00,0x03,0xFC,0x41,0xFE,0x01,0xFE,0x41,0xFE,0x08,0x98,0x18,0x10,0x12,0xFF,0xFE
};
UC top[16],bot[16];
UC i,k,f = 0;
init();
while (1) {
k = 100;
for (i = 0; i < 16; i++) {
top[i] = pos[f * 32 + i];
bot[i] = pos[f * 32 + i + 16];
}
while(k--) dzpDisplay(top,bot);
f = ++f % 3;
}
}16 * 16 循环移位
c
#include <REGX52.H>
typedef unsigned int UI;
typedef unsigned char UC;
/**
* 软延时
* @param i 毫秒
*/
void timer(UI i) {
UC j;
while (i--) for (j = 90; j > 0; j--);
}
// 初始化
void init(void) {
P0 = P1 = 0x00;
P2 = 0xF0;
}
// 点阵屏底层驱动
void dzpDisplay(UC * top,UC * bot) {
static UC i = 0;
P0 = top[i];
P1 = bot[i];
timer(2);
P0 = P1 = 0x00;
i = ++i % 16;
P2 += 0x01;
if (P2 == 0x10) P2 = 0x00;
}
// 入口
void main(void) {
UC code posTop[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x40,0x41,0x7F,0x7F,0x41,0x41,0x41,0x7F,0xFF,0x41,0x01,0x03,0x01,0x00,0x00,
0x00,0x00,0x10,0x22,0x2B,0x6F,0x6A,0xFE,0xBE,0xEA,0x6E,0x6B,0x23,0x31,0x20,0x00,0x00,0x00,
0x00,0x00,0xFF,0x44,0xFF,0x00,0xFF,0x44,0xFF,0x10,0xEF,0xDF,0x51,0x4B,0x7D,0x01
};
UC code posBot[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x10,0x10,0x10,0x90,0x10,0x10,0x10,0x10,0x32,0x12,0x07,0xFE,0xF8,0x00,0x00,0x00,
0x00,0x41,0x8B,0xC9,0xFF,0x7F,0xC9,0x8B,0x41,0x8B,0xC9,0x7F,0x7F,0xC9,0x8B,0x41,0x00,0x00,
0x00,0x03,0xFC,0x41,0xFE,0x01,0xFE,0x41,0xFE,0x08,0x98,0x18,0x10,0x12,0xFF,0xFE
};
UC top[16],bot[16];
UC i,v,f = 0;
init();
while (1) {
v = 30;
for (i = 0; i < 16; i++) {
top[i] = posTop[(i + f) % sizeof posTop];
bot[i] = posBot[(i + f) % sizeof posBot];
}
while(v--) dzpDisplay(top,bot);
f = ++f % sizeof posTop;
}
}