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

📄 lcd.cxgate

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

#pragma CODE_SEG XGATE_CODE
#pragma DATA_SEG __RPAGE_SEG XGATE_DATA

tLCD_data LCD_data;

#define LOAD_MEAS

/* LCD driver for generating 1/2 bias ratio waveforms. Must be called periodically in an interrupt */
interrupt void LCD_driver(tLCD_data *lcd_data) {
  #ifdef LOAD_MEAS
    lm_start(0);
  #endif
  LCD_INT_FLAG_CLEAR();
          /* what is the current cycle polarity ? */
  if (lcd_data->polarity==0) {  
          /* even refresh cycle */
          /* negative BP, positive data */
          /* is this a normal or a contrast adjustment phase ? */
    if (lcd_data->phase<LCD_BP_CNT) {
          /* normal phase */
      LCD_ONE_BP_LOW(lcd_data->phase);
      LCD_SET_FP_POS(lcd_data->active_data[lcd_data->phase]); 
    } else {
          /* contrast adjustment phase */  
      LCD_ALL_FP_LOW();
      LCD_ALL_BP_LOW();
    }
  } else {
          /* odd refresh cycle */
          /* positive BP, negative data */
          /* is this a normal or a contrast adjustment phase ? */
    if (lcd_data->phase<LCD_BP_CNT) {
          /* normal phase */
      LCD_ONE_BP_HIGH(lcd_data->phase);
      LCD_SET_FP_NEG(lcd_data->active_data[lcd_data->phase]); 
    } else {
          /* contrast adjustment phase */  
      LCD_ALL_FP_HIGH();
      LCD_ALL_BP_HIGH();
    }
  }
          /* decrement the phase number or re-initialise in case of 0 */
  if ((lcd_data->phase)==0) {
          /* reload phase */
    lcd_data->phase=lcd_data->phase_reload;
          /* change polarity */
    lcd_data->polarity^=1;
          /* end of an odd refresh cycle ? */
    if (lcd_data->polarity==0) {
          /* copy data into active data if at the end of every odd cycle */
      unsigned int *d_ptr, *s_ptr;
      d_ptr=(unsigned int*)((unsigned int*)lcd_data->active_data+sizeof(lcd_data->active_data)/sizeof(unsigned int)-1);
      s_ptr=(unsigned int*)((unsigned int*)lcd_data->data+sizeof(lcd_data->data)/sizeof(unsigned int)-1);
      while(d_ptr>=(unsigned int*)(lcd_data->active_data)) *(d_ptr--) = *(s_ptr--);
          /* copy values to active contrast and period variables */
      lcd_data->active_contrast=lcd_data->contrast;
      lcd_data->active_period=lcd_data->period;
    }
          /* change period to contrast adjustment period */
    LCD_INT_PERIOD_SET(lcd_data->active_contrast);
  } else {
          /* phase is non-zero */
          /* is the next period a normal period or a contrast adjustment period ? */
    if ((lcd_data->phase)==(LCD_BP_CNT)) {
          /* change to normal phase period */ 
      LCD_INT_PERIOD_SET(lcd_data->active_period);
    }
          /* decrement the phase counter */
    lcd_data->phase--;
  }
  #ifdef LOAD_MEAS
    lm_stop(0);
  #endif
}

⌨️ 快捷键说明

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