📄 19264cristl.c
字号:
#include <c8051f020.h> /*19264 举例*/
#include <intrins.h>
typedef unsigned char uchar;
typedef unsigned int uint;
uchar code X1[] = {
0x30,0x50,0xd0,0x90,0xf0,0x30,0x80,0x60,0x3c,0xe8,0x20,0xa0,0xe0,0x70,0x00,0x00,
0x04,0x06,0x03,0x11,0x13,0x12,0x18,0x0c,0x07,0x01,0x03,0x06,0x0c,0x1c,0x18,0x18
}; /*欢*/
uchar code X4[] = {
0x40,0x58,0x58,0xd0,0x10,0xf8,0x98,0x08,0x88,0xf8,0xf0,0x10,0xf8,0x70,0x00,0x00,
0x0c,0x04,0x04,0x07,0x04,0x05,0x0d,0x0d,0x08,0x1f,0x1b,0x19,0x38,0x38,0x18,0x18
}; /*迎*/
uchar code X2[] = {
0x30,0x30,0xf8,0xf8,0x08,0x10,0xd0,0x50,0x50,0xfc,0xfc,0x50,0xd0,0xf0,0x10,0x00,
0x00,0x00,0x1f,0x1f,0x10,0x10,0x13,0x1b,0x0f,0x07,0x05,0x0d,0x09,0x19,0x38,0x18
}; /*使*/
uchar code X3[] = {
0x00,0x00,0x00,0x00,0xfc,0xf8,0x48,0x48,0x48,0xf8,0xf8,0x48,0x48,0x48,0xfc,0xf8,
0x10,0x10,0x18,0x1e,0x0f,0x01,0x01,0x01,0x01,0x3f,0x1f,0x01,0x01,0x01,0x3f,0x3f
}; /*用*/
uchar code X5[] = {
0x18,0xfc,0x08,0x48,0x48,0xb8,0xd8,0x58,0xe8,0xb8,0xb8,0x08,0x08,0xf8,0xf8,0x00,
0x00,0x1f,0x11,0x11,0x11,0x14,0x15,0x16,0x16,0x10,0x11,0x11,0x11,0x3f,0x1f,0x00
}; /*图*/
uchar code X8[] = {
0xc0,0xc8,0xc8,0xf8,0xf8,0xc8,0xf8,0xf8,0xc8,0xc8,0x00,0x10,0x90,0xd8,0x48,0x48,
0x18,0x18,0x0c,0x0f,0x03,0x00,0x1f,0x1f,0x10,0x10,0x11,0x19,0x18,0x0c,0x04,0x06
}; /*形*/
uchar code X7[] = {
0x00,0x00,0x00,0xe0,0xe0,0x40,0x40,0x7c,0x7c,0x58,0x58,0x58,0xd0,0xd0,0x00,0x00,
0x10,0x18,0x08,0x0d,0x03,0x19,0x0d,0x01,0x01,0x0d,0x19,0x01,0x07,0x0c,0x18,0x38
}; /*点*/
uchar code X6[] = {
0x08,0xf8,0xf8,0x48,0xe8,0x98,0x90,0xd8,0xf0,0xbc,0xfc,0xd0,0x90,0x90,0x90,0x10,
0x00,0x3f,0x1f,0x02,0x03,0x05,0x06,0x07,0x07,0x06,0x3f,0x3f,0x06,0x06,0x04,0x04
}; /*阵*/
uchar code X12[] = {
0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,
0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa
}; /*....*/
uchar code X13[] = {
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
}; /*全黑*/
uchar code X14[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
}; /*全白*/
uchar code X15[]= {
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
}; /*上边*/
uchar code X16[]= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
}; /*下边*/
uchar code X17[]= {
0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
}; /*左边*/
uchar code X18[]= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff
}; /*右边*/
uchar code X19[]= {
0xff,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
}; /*左上*/
uchar code X20[]= {
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xff,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff
}; /*右上*/
uchar code X21[]= {
0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xff,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
}; /*左下*/
uchar code X22[]= {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xff
}; /*右下*/
sbit L_DI = P2^0;
sbit L_RW = P2^1;
sbit L_E = P2^4;
sbit L_CS1 = P2^7;
sbit L_CS2 = P2^6;
sbit L_SET = P2^2;
void delay(unsigned int ms)
{ unsigned int i,j;
for(i=0;i<=ms;i++)
{ for(j=0;j<=100;j++)
{ P4=0X00;
}
}
for(i=0;i<=ms;i++)
{ for(j=0;j<=100;j++)
{ P4=0X80;
}
}
}
void LCD_C_D(bit flag,unsigned char ldata)
{
L_DI = flag; L_E = 0; L_RW = 0;
P3= ldata;
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
L_E = 1;
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
L_E = 0;
}
void LCD_read(void)
{
L_DI = 1; L_E = 0; L_RW = 1;
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
L_E = 1;
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
L_E=0;
}
void CLRLCD(unsigned char number)
{
unsigned char i,j;
L_CS1 = 0;L_CS2 = 0;
for (i = 0xb8; i < 0xc0;i++)
{
LCD_C_D(0,i);
LCD_C_D(0,0X40);
for (j = 0; j < 0x40; j++)
LCD_C_D(1,number);
}
L_CS1 =1 ;L_CS2 = 0;
for (i = 0xb8; i < 0xc0;i++)
{
LCD_C_D(0,i);
LCD_C_D(0,0X40);
for (j = 0; j < 0x40; j++)
LCD_C_D(1,number);
}
L_CS1 = 0;L_CS2 = 1;
for (i = 0xb8; i < 0xc0;i++)
{
LCD_C_D(0,i);
LCD_C_D(0,0X40);
for (j = 0; j < 0x40; j++)
LCD_C_D(1,number);
}
}
void dis_one_zi(uchar x_add,uchar y_add,uchar code *po)
{
uchar i,j,w;
j = x_add*2+0xb8;
if(y_add<4)
{
w=y_add*16+0x40;
L_CS1=0; L_CS2=0;
}
if((y_add>3)&(y_add<8))
{
w=(y_add-4)*16+0x40;
L_CS1=0;
L_CS2=1;
}
if((y_add>7)&(y_add<12))
{
w=(y_add-8)*16+0x40;
L_CS1=1;
L_CS2=0;
}
LCD_C_D(0,j);
LCD_C_D(0,w);
for (i = 0; i < 32;i++)
{
if (i == 16)
{
LCD_C_D(0,j+1);
LCD_C_D(0,w);
}
LCD_C_D(1,*po++);
}
LCD_C_D(0,0X3F);
}
void SYSCLK_Init (void)
{
//int i; // delay counter
//OSCXCN = 0x67; // start external oscillator with
// 22.1184MHz crystal
//for (i=0; i < 256; i++) ; // Wait for osc. to start up
//while (!(OSCXCN & 0x80)) ; // Wait for crystal osc. to settle
//OSCICN = 0x88;
OSCICN = 0x05; // 系统时钟初始化为片内的 24.5MHz / 8
}
void PORT_Init (void)
{
XBR0 = 0x00; // 没有选择数字外设
XBR2 = 0x40;
P1=0x00;
// P3MDOUT = 0x00;
P1MDOUT = 0xFF;
}
void main(void) using 0
{
uchar data i,number;
uchar code *p;
WDTCN = 0xde;
WDTCN = 0xad;
SYSCLK_Init ();
PORT_Init ();
while(1)
{
LCD_C_D(0,0X3E);
p=X14;
for (number=1;number<3;number++)
{
for (i = 1; i < 11;i++)
{
dis_one_zi(number,i,p);
}
}
p=X15;
for (number=1;number<11;number++)
{
dis_one_zi(0,number,p);
}
p=X16;
for (number=1;number<11;number++)
{
dis_one_zi(3,number,p);
}
p=X17;
for (number=1;number<3;number++)
{
dis_one_zi(number,0,p);
}
p=X18;
for (number=1;number<3;number++)
{
dis_one_zi(number,11,p);
}
p=X19; dis_one_zi(0,0,p);
p=X20; dis_one_zi(0,11,p);
p=X21; dis_one_zi(3,0,p);
p=X22; dis_one_zi(3,11,p);
p=X1; dis_one_zi(1,3,p);
p=X2; dis_one_zi(1,5,p);
p=X3; dis_one_zi(1,7,p);
p=X4; dis_one_zi(1,9,p);
p=X5; dis_one_zi(2,3,p);
p=X6; dis_one_zi(2,5,p);
p=X7; dis_one_zi(2,7,p);
p=X8; dis_one_zi(2,9,p);
LCD_C_D(0,0X3F);
delay(1000); //delay(); delay();
LCD_C_D(0,0X3e);
p=X12;
for (number=0;number<4;number++)
{
for (i = 0; i < 12;i++)
{
dis_one_zi(number,i,p);
}
}
LCD_C_D(0,0X3f);
delay(1000); //delay(); delay();
LCD_C_D(0,0X3e);
p=X13;
for (number=0;number<4;number++)
{
for (i = 0; i < 12;i++)
{
dis_one_zi(number,i,p);
}
}
LCD_C_D(0,0X3f);
delay(1000); //delay(); delay();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -