📄 320.c
字号:
//*****************************************************
//
// 320240LCD
//
// BY JIANGLONGJIAN 2007/11/13
/* 示波器的设计:采用三个图层,L1为图形,L2为图形,L3为文本,
显示为8*10,每格显示20个点
*/
//
//*****************************************************
#include <reg52.h>
#include <stdlib.h> //标准函数
#include <intrins.h> //内部函数
#include <stdio.h> //I/O口函数
#include "LCM320240.H"
#define uchar unsigned char //变量类型标识的宏定义
#define uint unsigned int
#define MAX 31
uchar insert(uchar a[],uint *n,uint k,uint x)
{
int i;
if (*n==MAX) return 0;
if(*n<k)return 0;
if(*n>k)
for(i=*n;i>k;i--) a[i]=a[i-1];//往后移一位
a[i]=x;
(*n)++;
return 1;
}
//########################################################################################
void Main(void)
{
uchar i,j,k;
uint n;
// uchar a[MAX];//MAX=21当插完一个数据后的最大宽度
uchar b;
n=11;//已有数据
LCD_RST=1;
Delay(10); // 足够的延时确保lcm已经准备好
LcmInition();
LcmClear();
// 文本方式演示
// WriteCommand( Ovlay ); // 显示合成方式设置
// WriteData( 0x00 ); // 0000 0100 显示一区文本,三区文本属性,二重"或"合成
Locatexy(0,0,2); //0 --一区,1:2区
WriteCommand( CsrDirR); // 光标向右移动
WriteCommand( mWrite ); // 写数据(命令)
for(i=0;i<100;i++)
{
WriteData(0x31+i);
}
// WriteData(0xaa);
// WriteData(0xff);
// WriteData(0xff);
Locatexy(0,0,0); //0 --一区,1:2区
WriteCommand( mWrite ); // 写数据(命令)
WriteData(0xaa);
// Point(0, 0, 1, 0 );
Point(1, 0, 1, 0 );
Point(2, 1, 1, 0 );
// Point(0, 2, 1, 0 );
// Point(1, 2, 1, 0 );
// Point(2, 2, 1, 0 );
// Point(10,0, 0,0 );
WriteCommand( CsrW ); // 设置光标地址
Delay(1);
WriteData(0);
WriteData(0);
WriteCommand( mRead ); // 读显示ram指令
j = ReadDataLcm(); // 读取当前显示数据
k = ReadDataLcm(); // 读取当前显示数据
// 根据预定属性决定写点或擦除
//test
Locatexy(0,100, 0);
WriteCommand( mWrite); // 代码0x42,数据写入指令
WriteData(j); // 写入合成数据
WriteData(k); // 写入合成数据
while(1)
{
;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -