⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 text1.txt

📁 320*240点阵液晶(sed1335)驱动程序,keil c调试通过,io连接方式
💻 TXT
📖 第 1 页 / 共 5 页
字号:
/******************************************************
sed1335模拟io读写程序(8080模式)
c51 sed1335模拟io读写程序(8080模式)


condition:
controller pcb: ACP-LCM-1.53
controller:  sed1335
  timing mode:  8080
  compiler:  keil c51 

target: LM32019T display test

designer: hex
********************************************************
I/O configure:
1-8.DB0-DB7-----------P2
9.A0------------------P3.5
10.RD-----------------P3.7
11.WR-----------------P3.6
12.CS-----------------P3.3
13.RST----------------P3.4
14.VDD
15.VSS
********************************************************/

#include <REG1210.H>
#include "bin.h"
#include "comm.h" 


//#include<reg51.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define system_set  	0x40	//初始化设
#define sleep_in  		0x53	//休闲模式设置
#define disp_on   		0x59	//显示状态设置
#define disp_off  		0x58	//显示状态设置
#define scroll   		0x44	//显示域设置
#define scrform   		0x5d	//光标形状设置
#define cgram_adr  		0x5c	//CGRAM首址设置
#define csrdir_right 	0x4c	//光标移动方向设置
#define csrdir_left  	0x4d	//光标移动方向设置
#define csrdir_up  		0x4e	//光标移动方向设置
#define csrdir_down  	0x4f	//光标移动方向设置
#define hdot_scr  		0x5a	//电位移设置
#define ovlay   		0x5b	//显示合成设置
#define csrw   			0x46	//光标指针设置
#define csrr   			0x47	//读取光标指针
#define mwrite   		0x42	//数据写入
#define mread   		0x43	//数据读取



sbit write=P3^7;		//写数据或命令信号
sbit read=P3^6;			//读数据或命令信号
sbit cs=P3^5;			//片选 low
sbit a0=P3^4;			//数据或命令的选择信号
sbit rst=P3^3;			//复位信号 low

#define databus 		P0		//数据总线
sbit key=P1^0;



unsigned char code system_set_ini[8]={0x34,0x87,0x07,0x27,0x4a,0xf0,0x28,0x00};
unsigned char code scroll_ini1[6]={0x00,0x00,0xef,0x60,0x09,0xf0};
unsigned char code scroll_ini2[6]={0xb0,0x04,0x1e,0x60,0x09,0xf0};
unsigned char code scrform_ini[2]={0x07,0x86};
unsigned char code hdot_scr_ini[2]={0x00,0x0b};
unsigned char code ovlay_ini[1]={0x01};
unsigned char code disp_on_ini[1]={0x16};
unsigned char code disp_off_ini[1]={0x00};
unsigned char code cur_set_ini[2]={0x28,0x00};
unsigned char code cur_set_ini1[2]={0x00,0x00};
unsigned char code cur_set_ini2[2]={0xb8,0x04};
unsigned char code cur_set_ini3[2]={0x60,0x09};


unsigned char code word1[]={0x41,0x4e,0x44,0x4f,0x52,0x49,0x4e,0x20,0x4f,0x50,0x54,0x4f,0x45,0x4c,0x45,0x43,
							0x20,0x54,0x45,0x43,0x48,0x4e,0x4f,0x4c,0x4f,0x47,0x59,0x20,0x4c,0x54,0x44,0xa5,0x43,0x4f};
unsigned char code word2[8]={0x20,0x41,0x4e,0x44,0x4f,0x52,0x49,0x4e};
unsigned char code word3[]={0x00};
unsigned char code send[32]={0x21,0x31, 0x41,0x51,0x61,0x71,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39};
unsigned char code null[1]={0x00};
unsigned char code block_cur_set[2]={0x60,0x09};
unsigned char code an[32]={0x02,0x01,0x3F,0x20,0x44,0x06,0x04,0xFF,0x08,0x08,0x08,0x06,0x01,0x06,0x18,0xE0,
							0x00,0x00,0xFE,0x04,0x08,0x00,0x00,0xFE,0x20,0x20,0x40,0x80,0x00,0xC0,0x38,0x10};


unsigned char code hex1[1]={0xaa};
unsigned char code hex2[1]={0x55};
unsigned char code fill[1]={0XFF};
unsigned char code kright[1]={0X01};
unsigned char code kleft[1]={0x80};
unsigned char code hex3[1]={0x20};


unsigned char code an1[];
unsigned char code de[];
unsigned char code li[];
unsigned char code guang[];
unsigned char code dian[];
unsigned char code ke[];
unsigned char code ji[];
unsigned char code ando[];
unsigned char code tu1[];
unsigned char code tu2[];
unsigned char code box[];


void delay(int t)
{
	int i=0;
	for(i=0;i<t;i++);
}

void long_delay(int t)
{
	int i=0;
	int n;
	for(i=0;i<t;i++)
	{
		for(n=0;n<1000;n++);
	}
}

void sed1335_write(char commandcode, unsigned char code *parameter,int n)
{
	int i=0;
	
	a0=1;
	read=1;
	databus=commandcode;
	write=0;
	write=1;
	
	for(i=0;i<n;i++)
	{
		a0=0;
		read=1;
		databus=parameter[i];
		write=0;
		write=1;
	}
}

//在图形层写一个汉字//
void sed1335_write1(char commandcode,char low,int high)
{
	a0=1;
	read=1;
	databus=commandcode;
	write=0;
	write=1;
	
	a0=0;
	read=1;
	databus=low;
	write=0;
	write=1;
	
	a0=0;
	read=1;
	databus=high;
	write=0;
	write=1;
}



//写任何大小的一块, i为高度,j*8为宽度
wr_any(int low,int high, char word[],int i,int j)
{
	int k=0;
	for( k=0;k<j;k++)
	{
		sed1335_write1(csrw,low,high);
		sed1335_write(csrdir_down,null,1);
		sed1335_write(mwrite,word+i*k,i);
		low=low+1;
		if(low==0xff+1)
			low=0;high=high+1;
	}
}




void clr_scr()
{
	int i=0;
		
	sed1335_write(csrdir_right,null,1);
	sed1335_write(csrw,cur_set_ini1,2);
	a0=1;
	read=1;
	databus=mwrite;
	write=0;
	write=1;
	
	for(i=0;i<28800;i++)
	{
		a0=0;
		read=1;
		databus=0x00;
		write=0;
		write=1;
	}
	sed1335_write(csrw,cur_set_ini1,2);
}

//清除图形层
clrgrp_scr()
{
	int j=0;
	sed1335_write(csrw,cur_set_ini3,2);
	for(j=0;j<9600;j++)
		sed1335_write(mwrite,word3,1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -