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

📄 config.h

📁 多字节汉字屏显示控制程序
💻 H
字号:
/****************************************************************************************
//莫先明
//2007-11-09
****************************************************************************************/
/****************************************************************************************
头文件
****************************************************************************************/
#include   <reg52.h>
#define    uchar   unsigned char
#define    uint    unsigned int
#define    ulint   unsigned long
/****************************************************************************************
/****************************************************************************************
上位机软件的定义,有"TW"和"测试"
/***************************************************************************************/
#define		USEDTW		1		//当屏蔽这行使用测试程序
//#define		USEDOLDTW	1		//使用老版的TWP软件
/****************************************************************************************
控制板的定义
/***************************************************************************************/
#define		TPMCU		1
//#define		STATIC		1		//当为静态扫描时定义只支持1/8扫描方式

//#define		AUTOSTOP	1		//TPMCU还没有添加关机功能
/****************************************************************************************
系统防掉电存储器的定义
/***************************************************************************************/
//#define		W29C040		1	//系统存储器为W29C040
//#define		W29C020		1	//系统存储器为W29C020
/****************************************************************************************
串口通讯中地址的定义
/***************************************************************************************/
#define     OSC_FREQ	22118400L//40000000L//
#define		BPS      	19200   //定义串口通讯波特率有效值为(4800、9600、19200、57600)这些使用的是22.1184M频率
								//当定义为40M频率时不管BPS定义为何值都将自动使用19200速度
#define		ADDR		0		//设备地址=0-255
#define		MAXCOMBUF	120		//传口接收的最大显示幕数,这个大小应根据RAM容量而定,理论上是越大越好
								//注意当有防掉电存储器时该行定义是无效的
/****************************************************************************************
显示屏定义
/***************************************************************************************/
#define		MAXPLAN		20		//工作幕数缓冲最小为1
#define		LIEDIP	    160		//显示屏有多少列,可显示的汉字数为该值除以16
/****************************************************************************************
请注意到此有效的设置完毕
下面的内容请不要更改!!!!!!!!!!!!!!
****************************************************************************************/


//系统自动热启动超时复位
/****************************************************************************************/
#define     REBOOT  	system_run=600	//系统运行监视
										//运行异常将自动热起动
/****************************************************************************************
显示屏定义
****************************************************************************************/
#ifndef	TPMCU
#undef	STATIC
#endif

//#define		ALONE		1 		//当屏蔽该行时为32行扫描否则为16行扫描,屏蔽方式为在该行前加"//"
#ifdef	STATIC
 #undef	ALONE
#endif

#ifdef ALONE
	#define		HANGDIP			16		//行
#else
	#ifdef	STATIC
		#define		HANGDIP		16		//行
	#else
		#define		HANGDIP		32		//行
	#endif
#endif
/****************************************************************************************
显示方式定义
****************************************************************************************/
//#define		PRINT_L			1		//左移动输出方式
//#define		PRINT_R_LIE		1		//左移动输出方式
//#define		PRINT_L_LIE		1		//左移动输出方式
#define		PRINT_UP		1		//上移动输出方式
//#define		PRINT_UP_HANG	1		//上移动输出方式
//#define		PRINT_DOWN		1		//上移动输出方式
//#define		PRINT_DOWN_HANG	1		//上移动输出方式
//#define		PRINT_R			1		//左移动输出方式
/****************************************************************************************/
#define		RED		0
#define		GREEN	1
#define		YELLOW	2
#define		DEFINECOLOR RED

typedef struct windows
{

	uchar   plan_flash;			//FLASH中的总计幕数
	uchar	plan_point;			//指向FLASH中幕数的数值
	uchar	plan_size;			//当前缓冲的幕数

	uchar   plan;				//当前工作幕计数器
	uchar	hang;				//行位置指示
	uchar   lie;				//列
	uchar	bit_cont;			//位

	uchar movintype[MAXPLAN];
	uchar movouttype[MAXPLAN];
    uchar movsize[MAXPLAN];
	uchar showtime[MAXPLAN];
	/*下面是2个交换工作的缓冲区*/
	uchar	PRINT1_R[HANGDIP][LIEDIP/8];
	uchar	PRINT2_R[HANGDIP][LIEDIP/8];
	/*下面是字缓冲区*/
	uchar printbuf[MAXPLAN][HANGDIP*(LIEDIP/8)];
};

#define		SWAP_PRINT1  0
#define		SWAP_PRINT2  1

typedef struct PRINTLED
{
	uchar	SWAP;				//交换标志
	uchar	CHANG;				//允许外部交换的标志
	uchar	COLOR;
	uchar xdata	*PRINTBUF1_R1;
	#ifndef ALONE
		uchar xdata	*PRINTBUF1_R2;
	#endif

	uchar xdata	*PRINTBUF2_R1;
	#ifndef ALONE
		uchar xdata	*PRINTBUF2_R2;
	#endif
};

//串口通讯的数据结构
typedef struct usart
{
	/*
	#ifndef	 USEDTW
	//这里是测试程序的头字共5个字节
	uchar address;
	uchar head1;	//字头AA
	uchar head2;	//字头55
	uchar config;	//控制字
	uchar plan;		//幕数
	#else
	//这里是TW程序的头字共2个字节
	uchar address;
	uchar plan;		//幕数
	#endif
	*/
	uchar dip[(LIEDIP/8)*HANGDIP];	//点阵数据
	uchar movintype;
	uchar movouttype;
    uchar movsize;
	uchar showtime;
	#ifndef USEDTW
		uchar over;						//结束是一个0x00
	#else
		uchar addtype;					//追加方式
	#endif
};


typedef struct print_asm
{
	uchar xdata *ptr1_s;
	#ifndef ALONE
		uchar xdata *ptr2_s; //上半屏
	#endif
};


#ifndef     TPMCU
	sbit		CLK 		=	P1^4;
	sbit		DATA4094	=	P1^5;
	sbit		SING_RED	=	P1^6;
	sbit		SING_GREEN	=	P1^7;
	sbit		LAT			=	P1^3;
	sbit		OE			=	P3^3;
	#ifdef AUTOSTOP
		sbit    EXT0	=	P3^2;
	#endif
#else
	#undef		ATUOSTOP
	sbit		LAT		=	P3^2;
	sbit        CS_RAM  =   P3^4;
	sbit		HIB		=	P1^4;
	sbit		CLK 	=	P1^7;
    sbit        BOXSEL  =	P1^6;
#endif

#if(OSC_FREQ ==	40000000L)
	#undef		BPS
	#define		BPS      	19200
#endif
#define     BAUD_4800	256-(OSC_FREQ/192L)/4800L
#define     BAUD_9600	256-(OSC_FREQ/192L)/9600L
#define     BAUD_19200	256-(OSC_FREQ/192L)/19200L
#define     BAUD_57600	256-(OSC_FREQ/192L)/57600L

#ifdef		W29C040
	#define		DATAINFLASH			1		//定义系统使用FLASH存储器
#else
	#ifdef		W29C020
		#define		DATAINFLASH		1		//定义系统使用FLASH存储器
	#else
		#undef		DATAINFLASH				//无FLASH存储器
	#endif
#endif

#ifdef	DATAINFLASH
	sbit	    FLASH_A16 = P1^0;
	sbit	    FLASH_A17 = P1^1;
	sbit	    FLASH_A18 = P1^2;
	sbit	    FLASH_A15 = P2^7;
	sbit		CS_ROM	= 	P3^5;
    #ifdef		W29C040
	   #define		PAGESIZE 256		//flash页面大小
	   #define		WRITEEND 0			//写结束
    #endif
    #ifdef		W29C020
	   #define		PAGESIZE 128		//flash页面大小
	   #define		WRITEEND 128		//写结束
    #endif


typedef struct flash
{
  uchar xdata *pts1;
  uchar xdata *pts2;
  uchar xdata *ptd;
  uchar loop;
  uint  size;
};
#endif

⌨️ 快捷键说明

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