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

📄 lcdconf.h

📁 控制器为ST7529的液晶模块针对ucGUI的驱动
💻 H
字号:
/*
*********************************************************************************************************
*                                             uC/GUI V3.98
*                        Universal graphic software for embedded applications
*
*                       (c) Copyright 2002, Micrium Inc., Weston, FL
*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
*              礐/GUI is protected by international copyright laws. Knowledge of the
*              source code may not be used to write a similar product. This file may
*              only be used in accordance with a license and should not be redistributed
*              in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File        : LCDConf_7528_M4_M128x128.h
Purpose     : Sample configuration file
----------------------------------------------------------------------
*/

#ifndef LCDCONF_H
#define LCDCONF_H

/*********************************************************************
*
*                   General configuration of LCD
*
**********************************************************************
*/

#define LCD_XSIZE            160
#define LCD_YSIZE            160

#define LCD_CONTROLLER      7529

#define LCD_BITSPERPIXEL      4

/*********************************************************************
*
*                   Simple bus configuration
*
**********************************************************************
*/
/*0x6200F000 这个起始地址是考虑到bank0中A15-A13用作了扩展377的片选*/
#define  LCDPortCmd      *(volatile unsigned short*)(0x6200F002) //发送命令
#define  LCDPortData     *(volatile unsigned short*)(0x6200F000) //发送数据

void LCD_X_Write00(char c);  //CMD
void LCD_X_Write01(char c);  //DATA
void LCD_X_WriteM01(char * pData, int NumBytes);
//char LCD_X_Read00(c)   
char LCD_X_Read01(void);
#define LCD_WRITE_A1(Byte) LCD_X_Write01(Byte)
#define LCD_WRITE_A0(Byte) LCD_X_Write00(Byte)     //cmd
#define LCD_WRITEM_A1(pData, NumBytes) LCD_X_WriteM01(pData, NumBytes)

/*----液晶A0用P口控制时注释掉下面这行------*/
//#define LCD_READ_A1  (LCDPortData)
#ifndef LCD_READ_A1
    #define LCD_READ_A1  LCD_X_Read01()   
#endif

//#define LCD_READ_A0(Byte)  Byte = LCD_X_Read00()

/*********************************************************************
*
*       Initialisation macro
*
**********************************************************************
*/
#if 0
#define LCD_INIT_CONTROLLER()                                                         \
  LCD_X_Init();                                                                       \
  LCD_WRITE_A0(0x30); // Ext = 0                                \
  LCD_WRITE_A0(0xae); /* Display off */                                               \
  LCD_WRITE_A0(0x40); /* Set Initial Display Line Register */                         \
  LCD_WRITE_A0(0x00); /*   segment 0 */                                               \
  LCD_WRITE_A0(0x48); /* Partial Duty SET */                                          \
  LCD_WRITE_A0(0x00); /*   no operation max */                                        \
  LCD_WRITE_A0(0xa0); /* ADC normal */                                                \
  LCD_WRITE_A0(0xc8); /* SHL revers */                                                \
  LCD_WRITE_A0(0x44); /* Set initial COM0 register */                                 \
  LCD_WRITE_A0(0x00); /*   COM0 */                                                    \
  LCD_WRITE_A0(0xab); /* Oscillator on */                                             \
  LCD_WRITE_A0(0x67); /* Select DC-DC step-up */                                      \
  LCD_WRITE_A0(0x27); /* Select regulator register */                                 \
  LCD_WRITE_A0(0x81); /* Select electronic volum register */                          \
  LCD_WRITE_A0(0x38); /*   0x38 */                                                    \
  LCD_WRITE_A0(0x55); /* Select LCD bias */                                           \
  LCD_WRITE_A0(0x92); /* Select FRC and PWM mode */                                   \
  LCD_WRITE_A0(0x2c); /* Power control set: VC on */                                  \
  GUI_Delay(100);     /* Delay 100ms */                                               \
  LCD_WRITE_A0(0x2e); /* Power control set: VR on */                                  \
  GUI_Delay(100);     /* Delay 100ms */                                               \
  LCD_WRITE_A0(0x2f); /* Power control set: VF on */                                  \
  LCD_WRITE_A0(0x4c); /* Set N-line inversion */                                      \
  LCD_WRITE_A0(0x00); /*   0x00 */                                                    \
  LCD_WRITE_A0(0x38); /* Mode set */                                                  \
  LCD_WRITE_A0(0x05); /*   BE=1, EXT=1 */                                             \
  {                                                                                   \
    int i, j;                                                                         \
    U8 aRegInit[] = {00, 06, 11, 16, 21, 26, 31, 35, 39, 43, 47, 50, 53, 56, 58, 60}; \
    U8 Adr = 0x80;                                                                    \
    for (i = 0; i < 16; i++) {                                                        \
      for (j = 0; j < 4; j++) {                                                       \
        LCD_WRITE_A0(Adr++);                                                          \
        LCD_WRITE_A0(aRegInit[i]);                                                    \
      }                                                                               \
    }                                                                                 \
  }                                                                                   \
  LCD_WRITE_A0(0x38); /* Mode set */                                                  \
  LCD_WRITE_A0(0x04); /*   BE=1, EXT=0 */                                             \
  LCD_WRITE_A0(0xaf)  /* Display on */


#endif

#endif /* LCDCONF_H */
	 	 			 		    	 				 	  			   	 	 	 	 	 	  	  	      	   		 	 	 		  		  	 		 	  	  			     			       	   	 			  		    	 	     	 				  	 					 	 			   	  	  			 				 		 	 	 			     			 

⌨️ 快捷键说明

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