tst1.cpp

来自「英创386的LCD控制协议和函数,还有例程」· C++ 代码 · 共 68 行

CPP
68
字号
/*//////////////////////////////////////////////////////////////////////////
Orgnization:	Emtronix Incorporated
Filename:	TST1.CPP
Compiler:	BC3.1
Authors:	CS & ZhangHonglin
Date:		April, 2002
Revised:	...
Description:	This is a test routine for 128X64 DOT_LCD
///////////////////////////////////////////////////////////////////////////*/
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <math.h>

#include "lcd_api.h"

void main()
{
   int    x, y;
   struct  time t;

   //clrscr();
   printf( "\nDOT LCD Demo\n" );

   // goto graghic mode

   // initialize graphics mode
   LCD_Init( "mlib.chr", "ascii.chr" );
   LCD_SetMode( 1 );     // set to XOR mode

   // show chinese char at center position
   char BufStr[20];

   strcpy( BufStr, "** 欢迎测试 **" );
   x = (192-strlen(BufStr)*8)/2;
   y = 8;
   LCD_WriteString( x, y, BufStr, 1 );
   //_Writestring( x, y, BufStr, LCD_BACK, LCD_DOT );

   strcpy( BufStr, "嵌入式网络模块" );
   x = (192-strlen(BufStr)*8)/2;
   y = 24;
   LCD_WriteString( x, y, BufStr, 0 );

   // draw lines
   LCD_DrawLine( 0, 42, 191, 42, 1 );
   LCD_DrawLine( 0, 63, 191, 63, 1 );

   // draw curve
   for( x=0; x<192; x++ )
      {
      y = 53 - 10.0*sin( 2.0*M_PI*x/24.0 );;
      LCD_PutPixel( x, y, 1 );
      }

   for( x=0; x<192; x++ )
      {
      y = 53 - 10.0*sin( 2.0*M_PI*x/24.0 );;
      LCD_PutPixel( x, y, 1 );
      }


   LCD_FillBar( 0, 42, 191, 63, 0 );
   LCD_FillBar( 0, 42, 191, 63, 1 );
   LCD_FillBar( 0, 42, 191, 63, 0 );
   // exit
   LCD_Clearup( );
}

⌨️ 快捷键说明

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