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

📄 lcd_main.cpp

📁 采用并口控制液晶显示,适合PC104的嵌入式应用
💻 CPP
字号:
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include "winio.h"
#include "def.h"
#include "lcd.h"
#include "graphics.h"

void Display_Recv()
{
	
	LCD_FillRec(20, 0, 10, 42-1, 1);
	LCD_FillRec(20, 42, 10, 43-1, 0);
	LCD_FillRec(20, 85, 10, 43-1, 0);
	//	LCD_DrawRec(20, 0, 10, 42);
	LCD_DrawRec(20, 42-1, 10, 43+1);
	LCD_DrawRec(20, 85-1, 10, 43+1);

//	LCD_DrawCol(20, 0+1, 42-2, 0 );
//	LCD_DrawCol(20, 42+1, 43-2, 1 );
//	LCD_DrawCol(20, 85+1, 43-2, 1 );

	LCD_FillRec(1, 1, 20-1, 128-2, 0);

	LCD_Puts(22,14,(u8*)"Receive", 1);
	LCD_Puts(22,52,(u8*)"Send1", 0);
	LCD_Puts(22,100,(u8*)"Send2", 0);	
	
	LCD_Puts(5,1*16,(u8*)"rev1", 0);
	LCD_Puts(5,2*16,(u8*)"rev2", 0);
	LCD_Puts(5,3*16,(u8*)"rev3", 0);
	LCD_Puts(5,4*16,(u8*)"rev4", 0);
	LCD_Puts(5,5*16,(u8*)"rev5", 0);
	LCD_Puts(5,6*16,(u8*)"rev6", 0);
}
void Display_Send1()
{
	
	LCD_FillRec(20, 0, 10, 42-1, 0);
	LCD_FillRec(20, 42, 10, 43-1, 1);
	LCD_FillRec(20, 85, 10, 44-1, 0);

	LCD_DrawRec(20, 0, 10, 42);
//	LCD_DrawRec(20, 42-1, 10, 43+1);
	LCD_DrawRec(20, 85-1, 10, 43+1);

//	LCD_DrawCol(20, 0+1, 42-2, 1 );
//	LCD_DrawCol(20, 42+1, 43-2, 0 );
//	LCD_DrawCol(20, 85+1, 43-2, 1 );

	LCD_FillRec(1, 1, 20-1, 128-2, 0x00);

	LCD_Puts(22,14,(u8*)"Receive",0);
	LCD_Puts(22,52,(u8*)"Send1",1);
	LCD_Puts(22,100,(u8*)"Send2",0);	
	
	LCD_DrawRec(6, 3*16, 8, 17);
	LCD_Puts(7,3*16,(u8*)"data1",0);
	LCD_Puts(7,5*16,(u8*)"data2",0);
}

void Display_Send2()
{
	
	LCD_FillRec(20, 0, 10, 42-1, 0x00);
	LCD_FillRec(20, 42, 10, 43-1, 0x00);
	LCD_FillRec(20, 84, 10, 44-1, 0xFF);

	LCD_DrawRec(20, 0, 10, 42);
	LCD_DrawRec(20, 42-1, 10, 43+1);
//	LCD_DrawRec(20, 85-1, 10, 43+1);

//	LCD_DrawCol(20, 0+1, 42-2, BLACK );
//	LCD_DrawCol(20, 42+1, 43-2, BLACK );
//	LCD_DrawCol(20, 85+1, 43-2, WHITE );

	LCD_FillRec(1, 1, 20-1, 128-2, 0x00);

	LCD_Puts(22,14,(u8*)"Receive",0);
	LCD_Puts(22,52,(u8*)"Send1",0);
	LCD_Puts(22,100,(u8*)"Send2",1);	
	
	LCD_DrawRec(6, 3*16, 8, 17);
	LCD_Puts(7,3*16,(u8*)"data2",0);
	LCD_Puts(7,5*16,(u8*)"data1",0);
}

void main()
{
  bool bResult;
  int i;
//  U16 pos;

  // Call InitializeWinIo to initialize the WinIo library.
  bResult = InitializeWinIo();

  if (bResult)
  {
    LCD_Init();
	LCD_PutPixel8(0, 5, 0x10);
	LCD_DrawRec(0, 0, 30, 128);
	LCD_Puts(10,3*16,(u8*)"Loading   ",0);
	LCD_Puts(7,6*16-1,(u8*)"西 北 工 业 大 学",0);
	LCD_Puts(3,7*16-1,(u8*)"(C) Copyright 2005-2008",0);
	for (i=0;i<3;i++)
	{
		Sleep(500);
		LCD_Puts(10,3*16,(u8*)"Loading   ",0);
		Sleep(400);
		LCD_Puts(10,3*16,(u8*)"Loading.  ",0);
		Sleep(400);
		LCD_Puts(10,3*16,(u8*)"Loading.. ",0);
		Sleep(400);
		LCD_Puts(10,3*16,(u8*)"Loading...",0);
	}
	LCD_clr();
	LCD_DrawRec(0, 0, 30, 128);

	while(1)
	{
		Display_Recv();
		getch();
		Display_Send1();
		getch();
		Display_Send2();
		getch();
	}
    // When you're done using WinIo, call ShutdownWinIo
    ShutdownWinIo();
  }
  else
  {
    printf("Error during initialization of WinIo.\n");
    exit(1);
  }
}

⌨️ 快捷键说明

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