📄 main.c
字号:
//============================================================
// 工程名称:LCD501ShowDemo.spj
// 作者: xinqiang (email: xinqiang@sunnorth.com.cn)
// 联系方式:010-62981668-2916
// 适应芯片: SPCE061A
// 实现功能: SPLC501液晶显示模组驱动演示
//
// 系统要求: PC with CPU 233MHz,128MB RAM,
// SUNPLUS u'nSP IDE 1.8.4(or later)
//
// 涉及的库:(a) CMacro.lib
// (b)
//
// 组成文件:
// main.c
// SPLC501User.c
// SPLC501Driver_IO.asm/DataOSforLCD.asm
// SPLC501User.h/SPLC501Driver_IO.inc
//
// 当前版本: V1.0
// 日期: 2005-8-12
//
// 参考文件:
// 维护记录:
//--------------------------------------------------------------------------------------------------------
// Version YYYY-MM-DD-INDEX Modified By Description
//
//===============================================
///////////////////////////////////////////////////////////////////////////////
//文件名称: main.c
//描述: SPLC501模组驱动程序演示Demo的主程序文件
// LCD D0~D7接IOA8~IOA15
// LCD EP 接IOB6
// LCD RWP 接IOB5
// LCD A0 接IOB4
// LCD /CS1 接IOB9 或接地也可
//
// IO高电平:3.3V
//========================================================================================
#include "SPLC501USer.h"
#define P_Watchdog_Clear (unsigned int *)0x7012
#define P_SystemClock (unsigned int *)0x7013
//汉字字模数据,取模规则:自下到上,从左到右,以Word为单位
const unsigned int encoding_TT1[] = //凌
{
0x1010,
0x1800, 0x1e0c, 0x07b8, 0x0000, 0x49b0, 0x4cf6, 0x6676, 0x2fb6,
0x3bbf, 0x1b3f, 0x1f36, 0x3776, 0x60f6, 0x61b0, 0x2130, 0x0000
};
const unsigned int encoding_TT2[] = //阳
{
0x1010,
0x0000, 0x7fff, 0x7fff, 0x0c63, 0x0fff, 0x079f, 0x0000, 0x3ffe,
0x3ffe, 0x18c6, 0x18c6, 0x18c6, 0x3ffe, 0x3ffe, 0x0000, 0x0000
};
const unsigned int encoding_TT3[] = //科
{
0x1010,
0x0c6c, 0x066c, 0x036c, 0x7ffc, 0x7ffe, 0x0366, 0x0e60, 0x0c04,
0x0ccc, 0x0d98, 0x0c00, 0x7ffe, 0x7ffe, 0x0600, 0x0600, 0x0000
};
const unsigned int encoding_TT4[] = //技
{
0x1010,
0x0330, 0x6330, 0x7ffe, 0x3ffe, 0x01b0, 0x61b0, 0x60cc, 0x23cc,
0x37cc, 0x1cff, 0x1cff, 0x36cc, 0x23cc, 0x60cc, 0x6000, 0x0000
};
//软件延时函数
void Delay(unsigned int Delays)
{
unsigned int i,j;
for(j=0;j<Delays;j++)
{
for(i=0;i<10000;i++)
*P_Watchdog_Clear = 0x0001;
}
}
int main(void)
{
unsigned int dd;
*P_SystemClock = 0x0080; //设置高的CPU主频,可以操作得更快
LCD501_Init(0x0f); //初始化端口、包括LCD的初始设置、以及显示初始(即传到函数的参数)
Delay(100); //延时
LCD501_Rectangle(0,0,30,30,1); //画实心矩形
Delay(100); //
LCD501_SetPaintMode(2); //设置图形叠加模式
LCD501_Rectangle(40,0,70,30,1); //画实心矩形
Delay(100);
LCD501_SetPaintMode(3); //设置图形叠加模式
LCD501_Rectangle(80,0,110,30,1);//画实心矩形
Delay(100);
LCD501_ClrScreen(0); //Clear Screen
LCD501_SetPaintMode(1); //Set the paint mode = 1 COVER
Delay(50);
LCD501_PutPixel(0,0); //画点
Delay(50);
LCD501_PutPixel(0,1); //画点
Delay(50);
LCD501_PutPixel(0,2);
Delay(50);
LCD501_PutPixel(0,3);
Delay(50);
LCD501_PutPixel(0,4);
Delay(50);
LCD501_PutPixel(1,4);
Delay(50);
LCD501_PutPixel(2,4);
Delay(50);
LCD501_PutPixel(3,4);
Delay(50);
LCD501_PutPixel(4,4);
Delay(100);
LCD501_ClrScreen(0); //Clear Screen
LCD501_PutChar(0,8,'A'); //显示ASCII字符A
Delay(50);
LCD501_PutChar(8,0,'A');
Delay(50);
LCD501_PutChar(16,1,'A');
Delay(50);
LCD501_PutChar(24,5,'A');
Delay(100);
LCD501_ClrScreen(0); //Clear Screen
LCD501_Rectangle(0,0,60,60,0); //画矩形框
Delay(100);
LCD501_Rectangle(2,2,58,58,1); //画实心矩形
Delay(200);
LCD501_SetPaintMode(3); //
LCD501_PutChar(0,8,'A'); //显示ASCII字符
Delay(50);
LCD501_PutChar(8,0,'A');
Delay(50);
LCD501_PutChar(16,1,'A');
Delay(50);
LCD501_PutChar(24,5,'A');
Delay(200);
LCD501_ClrScreen(1);
Delay(100);
LCD501_ClrScreen(0); //清屏
Delay(100);
LCD501_PutString(8,50,(unsigned int *)"abcdefgdgfgshgjfkjhlkgl"); //显示字符串
Delay(200);
LCD501_ClrScreen(0); //清屏
LCD501_Circle(30,30,30,1); //画实心圆
Delay(200);
LCD501_SetPaintMode(3); //
LCD501_Line(1,30,127,30); //画直线
Delay(200);
LCD501_Bitmap(0,15,(unsigned int *)encoding_TT1); //显示汉字:凌
LCD501_Bitmap(16,15,(unsigned int *)encoding_TT2); //阳
LCD501_Bitmap(32,15,(unsigned int *)encoding_TT3); //科
LCD501_Bitmap(48,15,(unsigned int *)encoding_TT4); //技
while(1)
{ //向上滚屏!!
*P_Watchdog_Clear = 0x0001; //清看门狗
for(dd=0;dd<64;dd++)
{
LCD501_ScrollUp(1);
Delay(15);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -