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

📄 lcd.c

📁 飞思卡尔液带晶驱动的MCU例程 飞思卡尔液带晶驱动的MCU例程
💻 C
字号:
#include "per_XDx512_L15Y.h"
#include "LCD.h"

/* start-up of the LCD driver. Parameters: bus frequency in kHz, contrast adjustment coefficient */
void LCD_start(unsigned int bus_frequency, int contrast_adj) {
                                /* calculate normal phase time and contrast adjustment phase time */
  LCD_contrast(bus_frequency, contrast_adj);
	                              /* update the active period and contrast variables by hand */
	LCD_data.active_period=LCD_data.period;	    
	LCD_data.active_contrast=LCD_data.contrast;
                                /* initialise state and state reload */
  LCD_data.phase = LCD_data.phase_reload = (LCD_BP_CNT+LCD_IDLE_CNT)-1; 
  LCD_data.polarity=0;
  LCD_ALL_PINS_LOW();           /* drive all pins low once they are configured as outputs */
  LCD_ALL_CONFIGURE();          /* configure all pins as outputs */
	LCD_INT_CONFIGURE();          /* configure the periodic interrupt source */
}

/* contrast adjustment: normal phase and contrast adjustment phase calculation */
void LCD_contrast(unsigned int bus_frequency, int contrast_adj) {
  LCD_data.period = ((((unsigned long int)1000/LCD_INT_DIVISOR*bus_frequency/LCD_FRAME_FREQUENCY)-LCD_IDLE_CNT*(unsigned long int)contrast_adj)/(LCD_BP_CNT+LCD_IDLE_CNT))-1;
	LCD_data.contrast = LCD_data.period + contrast_adj;
}

/* shutdown of the LCD driver */
void LCD_stop(void) {
	LCD_INT_STOP();               /* stop the interrupt source */
	LCD_ALL_PINS_LOW();			      /* drive all pins low */
}

⌨️ 快捷键说明

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