📄 lcd.c
字号:
#include "2407c.h"
#include "LCD.h"
unsigned int str1[240]=
{ //南京师范大学物理科学与技术学院
0x0004,0x0004,0x7FE4,0x0424,0x0524,0x0564,0x05B4,0x7F2F,
0x0524,0x05A4,0x0564,0x2524,0x4424,0x3FE6,0x0004,0x0000,
0x0000,0x2004,0x1004,0x19E4,0x0D24,0x4124,0x8125,0x7F26,
0x0124,0x0124,0x0524,0x0DE4,0x3806,0x1004,0x0000,0x0000,
0x4000,0x27FC,0x1000,0x0E00,0x01FF,0x0000,0x0FF2,0x0012,
0x0012,0x0012,0xFFFE,0x0012,0x0412,0x0812,0x07F2,0x0000,
0x0844,0x0994,0xF8A4,0x0464,0x0304,0x000F,0x0004,0x3FE4,
0x4024,0x402C,0x422F,0x4624,0x43E4,0x7004,0x0004,0x0000,
0x0020,0x8020,0x4020,0x2020,0x1020,0x0C20,0x03A0,0x007F,
0x01A0,0x0620,0x0820,0x3020,0x6020,0xC020,0x4020,0x0000,
0x0040,0x0230,0x0210,0x0212,0x025C,0x0254,0x4250,0x8251,
0x7F5E,0x02D4,0x0250,0x0218,0x0257,0x0232,0x0210,0x0000,
0x0440,0x043C,0x0210,0x7FFF,0x0110,0x44D0,0x2220,0x1118,
0x08CF,0x0438,0x4308,0x80F8,0x4008,0x3FF8,0x0000,0x0000,
0x1044,0x1044,0x0FFC,0x0844,0x4844,0x4000,0x45FE,0x4492,
0x4492,0x7FFE,0x4492,0x4492,0x4492,0x45FE,0x4000,0x0000,
0x0410,0x0212,0x0192,0x0072,0xFFFE,0x0051,0x0491,0x0400,
0x0422,0x02CC,0x0200,0x0200,0xFFFF,0x0100,0x0100,0x0000,
0x0040,0x0230,0x0210,0x0212,0x025C,0x0254,0x4250,0x8251,
0x7F5E,0x02D4,0x0250,0x0218,0x0257,0x0232,0x0210,0x0000,
0x0000,0x0400,0x0400,0x0400,0x047E,0x0448,0x0448,0x0448,
0x0448,0x2448,0x4648,0x4448,0x2048,0x1FCC,0x0008,0x0000,
0x0108,0x4108,0x8088,0x7FFF,0x0048,0x4028,0x4000,0x20C8,
0x1348,0x0C48,0x0C7F,0x1248,0x21C8,0x6048,0x2008,0x0000,
0x1010,0x1010,0x0810,0x0410,0x0210,0x0190,0x0050,0x7FFF,
0x0050,0x0090,0x0112,0x0614,0x0C10,0x1810,0x0810,0x0000,
0x0040,0x0230,0x0210,0x0212,0x025C,0x0254,0x4250,0x8251,
0x7F5E,0x02D4,0x0250,0x0218,0x0257,0x0232,0x0210,0x0000,
0xFFFE,0x0002,0x0232,0x044A,0x8386,0x410C,0x3124,0x0F24,
0x0125,0x0126,0x7F24,0x8124,0x8124,0x810C,0xF104,0x0000
};
unsigned int ledkey[10][8]=
{
{0x00,0x00,0x7C,0x82,0x82,0x82,0x7C,0x00}, //0
{0x00,0x00,0x00,0x84,0xFE,0x80,0x00,0x00}, //1
{0x00,0x00,0x84,0xC2,0xA2,0x92,0x8C,0x00}, //2
{0x00,0x00,0x44,0x92,0x92,0x92,0x6C,0x00},
{0x00,0x00,0x30,0x28,0x24,0xFE,0x20,0x00},
{0x00,0x00,0x4E,0x92,0x92,0x92,0x62,0x00},
{0x00,0x00,0x7C,0x92,0x92,0x92,0x64,0x00},
{0x00,0x00,0x02,0xC2,0x32,0x0A,0x06,0x00},
{0x00,0x00,0x6C,0x92,0x92,0x92,0x6C,0x00},
{0x00,0x00,0x4C,0x92,0x92,0x92,0x7C,0x00}
};
unsigned int nScreenBuffer[30*128];
#define CTRSTATUS (*(unsigned int *)0x108000) //port8000
int w,ww,www;
main()
{
unsigned int uWork,* pWork;
int /*x0,y0,*/x,y,a,b,color,i;
*WDCR=0x6f;
*WDKEY=0x5555;
*WDKEY=0xaaaa;
*SCSR1=0x81fe;
*IMR=0x0;
*IFR=0xffff;
uWork=(*WSGR);
uWork&=0x0fe3f;
(*WSGR)=uWork;
LCDTurnOff();
LCDSetScreenBuffer(nScreenBuffer);
for ( uWork=0,pWork=nScreenBuffer;uWork<30*128;uWork++,pWork++ ) (*pWork)=0;
LCDSetDelay(1);
LCDTurnOn(); // 打开显示
LCDCLS();
//for(;;)
//{
LCDPutCString(str1,0,128,15,3);//显示字符"南京师范大学物理科学与技术学院"
//_Delay(200);
//}
w=0; ww=5,www=50;
x=0;y=0;color=1;
for(i=0;i<50;i++) //在左下角画斜线
{
LCDPutPixel(x,y,color);
x++;
y++;
}
/*x0=60;y0=60;x=100;y=80;color=1;
LCDDrawLine(x0,y0,x,y,color);*/
x=0;y=8;color=1;
for(i=0;i<10;i++) //循环显示0到9
{
LCDWriteBytes(ledkey[i],x,y,color);
_Delay(www);
}
x=0;y=8;color=0;
for(i=9;i>=0;i--) //循环显示9到0
{
LCDWriteBytes(ledkey[i],x,y,color);
_Delay(www);
}
while ( 1 )
{
if ( w ) break;
x=0; y=0; a=1; b=1; color=2;
for (i=0;i<1024;i++) //画移动方框
{
LCDDrawLine(x,y,x+10,y,color);
LCDDrawLine(x,y,x,y+10,color);
LCDDrawLine(x+10,y,x+10,y+10,color);
LCDDrawLine(x,y+10,x+10,y+10,color);
LCDRefreshScreen();
_Delay(ww);
LCDDrawLine(x,y,x+10,y,color);
LCDDrawLine(x,y,x,y+10,color);
LCDDrawLine(x+10,y,x+10,y+10,color);
LCDDrawLine(x,y+10,x+10,y+10,color);
x+=a; y+=b;
if ( x>230 || x<0 ) a=-a;
if ( y>118 || y<0 ) b=-b;
if ( w ) break;
}
}
LCDCLS(); // 清除显示内存
LCDTurnOff();
LCDSetDelay(0);
exit(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -