Skip to content

知识点

  1. 低列高行,高行强推

实物

共阴(文字朝上)

12345678
H6H3L4H1L6L7H2H4
910111213141516
H8L5L3H5L8H7L2L1

共阴(文字朝下)

12345678
L8L7H2L1H4L6L4H1
910111213141516
H5H7L2L3H8L5H6H3

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;
    }
}

基于 MIT 许可发布