tsk_lcd.c

来自「使用RTX-51 tiny操作系统的em12864液晶驱动程序」· C语言 代码 · 共 58 行

C
58
字号
/********************************/
//定义字符串数组		
/********************************/

char code STR1[]={ 0x80,0x81,0x82,0x83,0x84,0x85	};
char code STR2[]="em12864 ";

#include 	<reg52.h>                    /* special function registers 8052      */
#include 	<rtx51tny.h>                 /* RTX-51 tiny functions & defines      */
#include 	<stdio.h>                    /* standard I/O .h-file                 */
#include 	<string.h>                   /* string and memory functions          */
#include 	<lcd.h>                  /* string and memory functions          */
#include	<MATYP.h>



/******************************************************************************/
/*        Task 7 'lcd_tsk':     */
/******************************************************************************/
void lcd_tsk (void) _task_ LCD_TSK  
{
	Uchar x=0;
	Lcminit();				/*液晶模块初始化,包括全屏幕清屏*/
	Putstr(0,0,STR2,6);	/*第一行字符输出,24字节	*/
	os_wait (K_TMO, 20, 0);  
	Putstr(0,2,STR1,8);	/*第二行字符输出,12字节(汉字)*/
	os_wait (K_TMO, 20, 0);  
	Linexy(0,0,127,0);		/*line (0,0)-(191,0)	*/
	os_wait (K_TMO, 20, 0);  
	Linexy(127,0,127,32);	/*line (191,0)-(191,32)	*/
	os_wait (K_TMO, 20, 0);  
	Linexy(127,32,0,32);	/*line (191,32)-(0,32)	*/
	os_wait (K_TMO, 20, 0);  
	Linexy(0,32,0,0);		/*line (0,32)-(0,0)	*/
	os_wait (K_TMO, 20, 0);  
	Linexy(1,15,127,15);	/*line (1,15)-(191,15)	*/
	os_wait (K_TMO, 20, 0);  
	Linexy(0,63,44,33);	/*line (0,63)-(44,33)	*/
	os_wait (K_TMO, 20, 0);  
	Linexy(44,33,127,63);	/*line (44,33)-(191,63)	*/
	os_wait (K_TMO, 20, 0);  
 	circle(46,49,12);		//画一个圆
	os_wait (K_TMO, 20, 0);  
	circle(46,49,11);
//	D_Ads1110[0])
	while(1){
		Rollscreen(x);		/*定位新的显示起始行	*/
		os_wait(K_TMO, 5, 0);  
		x++;
		if (x>64)
		{
			x=0;
			os_wait(K_TMO,500, 0);  
		}
	};

}

⌨️ 快捷键说明

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