LED P5全彩 3264 生成字模 By STC12C5A60S2单片机
字模生成软件: PCtoLCD2002完美版.rar
下载 PCtoLCD2002完美版.rar
PCtoLCD2002 软件设置
效果图:
生成字模
1 |
|
应用字模
C51 代码1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206//STC12C5A60S2 @12M晶振
#include <STC12C5A60S2.H>
#include <intrins.h>
sbit R1 = P0 ^ 0;
sbit G1 = P0 ^ 1;
sbit B1 = P0 ^ 2;
sbit R2 = P0 ^ 3;
sbit G2 = P0 ^ 4;
sbit B2 = P0 ^ 5;
sbit IA = P2 ^ 7; //行控制线A
sbit IB = P2 ^ 6; //行控制线B
sbit IC = P2 ^ 5; //行控制线C
sbit ID = P2 ^ 4; //行控制线D
sbit CK = P2 ^ 2; //时钟
sbit LS = P2 ^ 1; //锁存
sbit OE = P2 ^ 0; //输出,低电平有效
#define SCAN(X) IA=(X)&1; IB=(X)&2; IC=(X)&4; ID=(X)&8;
unsigned short ms = 0;
unsigned short sec = 0;
unsigned char RD1[8]; //数据缓存
unsigned char GD1[8];
unsigned char BD1[8];
unsigned char RD2[8];
unsigned char GD2[8];
unsigned char BD2[8];
unsigned char code Num16x32[][64]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x06,0x60,0x0C,0x30,0x18,0x18,
0x18,0x18,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0E,0x60,0x06,0x60,0x06,0x60,0x06,
0x60,0x06,0x60,0x06,0x60,0x06,0x60,0x06,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,
0x18,0x18,0x18,0x18,0x0C,0x30,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"0",0*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x07,0x80,0x09,0x80,
0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,
0x01,0x80,0x01,0x80,0x03,0x80,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"1",1*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x07,0xE0,0x08,0x70,0x10,0x38,
0x20,0x18,0x20,0x18,0x40,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x18,0x00,0x30,
0x00,0x30,0x00,0x60,0x00,0x60,0x00,0xC0,0x01,0x80,0x01,0x00,0x02,0x00,0x04,0x02,
0x0C,0x04,0x18,0x04,0x3F,0xFC,0x7F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"2",2*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x07,0xE0,0x08,0x30,0x10,0x30,
0x20,0x18,0x20,0x18,0x00,0x10,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0xE0,0x03,0xF0,
0x04,0x78,0x00,0x38,0x00,0x1C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x08,0x00,0x08,
0x00,0x18,0x00,0x10,0x38,0x60,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"3",3*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x30,0x00,0x30,0x00,0x70,
0x00,0xF0,0x00,0xB0,0x01,0xB0,0x01,0x30,0x02,0x30,0x06,0x30,0x04,0x30,0x08,0x30,
0x18,0x30,0x10,0x30,0x30,0x30,0x20,0x30,0x7F,0xFE,0x7F,0xFE,0x00,0x30,0x00,0x30,
0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"4",4*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x03,0xFC,0x03,0xF8,0x06,0x00,
0x04,0x00,0x0C,0x00,0x0C,0x00,0x0F,0x00,0x1F,0xC0,0x07,0xE0,0x00,0xF0,0x00,0x38,
0x00,0x18,0x00,0x08,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,0x08,0x00,0x08,
0x00,0x18,0x00,0x10,0x3C,0x60,0x1F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"5",5*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x60,0x01,0x80,0x03,0x00,
0x06,0x00,0x0C,0x00,0x1C,0x00,0x18,0x00,0x38,0x00,0x33,0xE0,0x34,0x78,0x38,0x18,
0x30,0x0C,0x60,0x0C,0x60,0x0C,0x20,0x06,0x20,0x06,0x30,0x04,0x30,0x04,0x30,0x0C,
0x10,0x0C,0x18,0x08,0x0C,0x10,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"6",6*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFC,0x1F,0xFC,0x30,0x0C,
0x20,0x0C,0x20,0x08,0x00,0x18,0x00,0x18,0x00,0x10,0x00,0x10,0x00,0x30,0x00,0x30,
0x00,0x20,0x00,0x60,0x00,0x60,0x00,0x40,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0x80,
0x01,0x80,0x01,0x80,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"7",7*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x0E,0x70,0x18,0x10,0x10,0x08,
0x30,0x08,0x30,0x08,0x30,0x08,0x18,0x18,0x18,0x10,0x0E,0x20,0x0F,0x40,0x07,0xC0,
0x03,0xE0,0x04,0xF0,0x08,0x38,0x10,0x1C,0x30,0x0C,0x30,0x0E,0x30,0x06,0x30,0x06,
0x30,0x04,0x30,0x0C,0x18,0x18,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"8",8*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x0E,0x60,0x18,0x30,0x10,0x18,
0x30,0x18,0x30,0x0C,0x20,0x0C,0x20,0x0C,0x60,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,
0x38,0x0C,0x1C,0x1C,0x0F,0xEC,0x00,0x0C,0x00,0x18,0x00,0x18,0x00,0x30,0x00,0x60,
0x00,0xE0,0x01,0xC0,0x03,0x00,0x0E,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"9",9*/
/* (16 X 32 , @MingLiU_HKSCS-ExtB )*/
};
void Delay100us() //@12.000MHz
{
unsigned char i, j;
_nop_();
_nop_();
i = 2;
j = 38;
do
{
while (--j);
} while (--i);
}
void SendRGB(int s)
{
unsigned int i;
unsigned int j;
unsigned int k;
unsigned int num1 = (s / 1000) % 10;
unsigned int num2 = (s / 100) % 10;
unsigned int num3 = (s / 10) % 10;
unsigned int num4 = s % 10;
for(i = 0; i < 16; i++) //扫描行数
{
SCAN(i); //选择扫描行
//载入此行的 上半屏数据 8*8=64bit
RD1[0] = Num16x32[num1][i * 2];
RD1[1] = Num16x32[num1][i * 2 + 1];
RD1[2] = Num16x32[num2][i * 2];
RD1[3] = Num16x32[num2][i * 2 + 1];
RD1[4] = Num16x32[num3][i * 2];
RD1[5] = Num16x32[num3][i * 2 + 1];
RD1[6] = Num16x32[num4][i * 2];
RD1[7] = Num16x32[num4][i * 2 + 1];
//载入此行的 下半屏数据 8*8=64bit
RD2[0] = Num16x32[num1][32 + i * 2];
RD2[1] = Num16x32[num1][32 + i * 2 + 1];
RD2[2] = Num16x32[num2][32 + i * 2];
RD2[3] = Num16x32[num2][32 + i * 2 + 1];
RD2[4] = Num16x32[num3][32 + i * 2];
RD2[5] = Num16x32[num3][32 + i * 2 + 1];
RD2[6] = Num16x32[num4][32 + i * 2];
RD2[7] = Num16x32[num4][32 + i * 2 + 1];
for(j = 0; j < 8; j++)
{
for(k = 0; k < 8; k++)
{
RD1[j] <<= 1;
R1 = CY;
G1 = CY;
B1 = CY;
RD2[j] <<= 1;
R2 = CY;
G2 = CY;
B2 = CY;
//时钟
CK=1;
CK=0;
}
}
//锁存
LS=1;
LS=0;
//显示开
OE=0;
Delay100us();
OE=1;
}
}
void Timer0Init(void) //1毫秒@12.000MHz
{
AUXR |= 0x80; //定时器时钟1T模式
TMOD &= 0xF0; //设置定时器模式
TL0 = 0x20; //设置定时初始值
TH0 = 0xD1; //设置定时初始值
TF0 = 0; //清除TF0标志
TR0 = 1; //定时器0开始计时
ET0 = 1; //定时器0中断允许
EA = 1; //开启全局中断
}
int main()
{
Timer0Init();
while(1)
{
SendRGB(sec);
}
}
void timer0 (void) interrupt 1
{
ms++;
if(ms >=1000)
{
sec++;
ms = 0;
}
}