收藏小站
液晶驅動C語言 - 下載本文

while ((*ptr != 0) && (i < 20)) // 20 { LCD_DisplayChar(Line, refcolumn, *ptr); refcolumn -= 16; ptr++; i++; } }

/*******************************************************************************

* Function Name : LCD_SetDisplayWindow * Description : Sets a display window

* Input : - Xpos: specifies the X buttom left position. * - Ypos: specifies the Y buttom left position. * - Height: display window height. * - Width: display window width. * Output : None * Return : None

*******************************************************************************/

void LCD_SetDisplayWindow(u8 Xpos, u16 Ypos, u8 Height, u16 Width) { if(Xpos >= Height) { LCD_WriteReg(R80, (Xpos - Height + 1)); } else { LCD_WriteReg(R80, 0); } LCD_WriteReg(R81, Xpos); if(Ypos >= Width) { LCD_WriteReg(R82, (Ypos - Width + 1)); } else { LCD_WriteReg(R82, 0); } /* Vertical GRAM End Address */ LCD_WriteReg(R83, Ypos); LCD_SetCursor(Xpos, Ypos); }

/*******************************************************************************

* Function Name : LCD_WindowModeDisable * Description : Disables LCD Window mode. * Input : None * Output : None * Return : None

*******************************************************************************/

void LCD_WindowModeDisable(void) { LCD_SetDisplayWindow(239, 0x13F, 240, 320); LCD_WriteReg(R3, 0x1018); }

/*******************************************************************************

* Function Name : LCD_DrawLine * Description : Displays a line.

* Input : - Xpos: specifies the X position. * - Ypos: specifies the Y position. * - Length: line length. * - Direction: line direction.

* This parameter can be one of the following values: Vertical * or Horizontal. * Output : None * Return : None

*******************************************************************************/

void LCD_DrawLine(u8 Xpos, u16 Ypos, u16 Length, u8 Direction) { u32 i = 0; LCD_SetCursor(Xpos, Ypos); if(Direction == Horizontal) { LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ for(i = 0; i < Length; i++) { LCD_WriteRAM(TextColor); } } else { for(i = 0; i < Length; i++)

{ LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ LCD_WriteRAM(TextColor); Xpos++; LCD_SetCursor(Xpos, Ypos); } } }

/*******************************************************************************

* Function Name : LCD_DrawRect * Description : Displays a rectangle.

* Input : - Xpos: specifies the X position. * - Ypos: specifies the Y position. * - Height: display rectangle height. * - Width: display rectangle width. * Output : None * Return : None

*******************************************************************************/

void LCD_DrawRect(u8 Xpos, u16 Ypos, u8 Height, u16 Width) { LCD_DrawLine(Xpos, Ypos, Width, Horizontal); LCD_DrawLine((Xpos + Height), Ypos, Width, Horizontal); LCD_DrawLine(Xpos, Ypos, Height, Vertical); LCD_DrawLine(Xpos, (Ypos - Width + 1), Height, Vertical); }

/*******************************************************************************

* Function Name : LCD_DrawCircle * Description : Displays a circle.

* Input : - Xpos: specifies the X position. * - Ypos: specifies the Y position. * - Height: display rectangle height. * - Width: display rectangle width. * Output : None * Return : None

*******************************************************************************/

void LCD_DrawCircle(u8 Xpos, u16 Ypos, u16 Radius) { s32 D; u32 CurX;

u32 CurY;

D = 3 - (Radius << 1); CurX = 0;

CurY = Radius;

while (CurX <= CurY) {

LCD_SetCursor(Xpos + CurX, Ypos + CurY);

LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ LCD_WriteRAM(TextColor);

LCD_SetCursor(Xpos + CurX, Ypos - CurY);

LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ LCD_WriteRAM(TextColor);

LCD_SetCursor(Xpos - CurX, Ypos + CurY);

LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ LCD_WriteRAM(TextColor);

LCD_SetCursor(Xpos - CurX, Ypos - CurY);

LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ LCD_WriteRAM(TextColor);

LCD_SetCursor(Xpos + CurY, Ypos + CurX);

LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ LCD_WriteRAM(TextColor);

LCD_SetCursor(Xpos + CurY, Ypos - CurX);

LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ LCD_WriteRAM(TextColor);

LCD_SetCursor(Xpos - CurY, Ypos + CurX);

LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ LCD_WriteRAM(TextColor);

LCD_SetCursor(Xpos - CurY, Ypos - CurX);

LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ LCD_WriteRAM(TextColor);

if (D < 0) {

D += (CurX << 2) + 6; }

else { D += ((CurX - CurY) << 2) + 10; CurY--; } CurX++; } }

/*******************************************************************************

* Function Name : LCD_DrawMonoPict

* Description : Displays a monocolor picture. * Input : - Pict: pointer to the picture array. * Output : None * Return : None

*******************************************************************************/

void LCD_DrawMonoPict(uc32 *Pict) { u32 index = 0, i = 0; LCD_SetCursor(0, 319); LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */ for(index = 0; index < 2400; index++) { for(i = 0; i < 32; i++) { if((Pict[index] & (1 << i)) == 0x00) { LCD_WriteRAM(BackColor); } else { LCD_WriteRAM(TextColor); } } } }

/*******************************************************************************

* Function Name : LCD_WriteBMP

* Description : Displays a bitmap picture loaded in the internal Flash. * Input : - BmpAddress: Bmp picture address in the internal Flash.

  • 1
  • 2
  • 3
  • 4
  • 5



最新浏覽
  • 液晶驅動C語言 -
  • 學 校 概 況 - 24876 -
  • 質量體系外審中發現問題的整改要求 -
  • 華僑古詩文背誦(1)(1) -
  • 海上施工船舶安全管理制度 - 圖文 -
  • 2016-2017年河北省衡水中學高二上學期期中數學試卷及參考答案(理科)&nb
  • 衡水市2011年政府工作報告 -
  • 2018九年級英語上冊Unit6TVprogrammes練習新版牛津版6 - 圖
  • 甲級單位編制旋轉蒸發儀項目可行性報告(立項可研+貸款+用地+2013案例)設計方
  • 2013-2014學年高二下學期數學(理)活動單學案:第3課時 - 獨立性(1)


熱門浏覽
  • 淺談情景教學法在小學體育教學中的運用 -
  • 八年級語文上冊第二單元第5課棗核課堂訓練蘇教版 -
  • BRAS測試方案 -
  • 計算說明書模板參考 -
  • 最全的公務員常識40000道4萬道題目啊!! -
  • [附答案]中考物理二輪專題複習學案:專題8電學計算 - 圖文 -
  • 海上施工船舶安全管理制度 - 圖文 -
  • 高考物理“壓軸”大題專項突破“壓軸”大題專項突破考點知識總複習教案60 
  • 2700噸馬鈴薯澱粉制品技改項目 -
  • 女性服飾可分爲八大款,即八大風格分析 -
  • 水浒傳120回每回故事梗概(1~70回很詳細,很好用,結尾有驚喜) -
  • 2018河北省中國農業銀行會有春季招聘嗎 -
  • 外研版小學英語六年級上冊第六模塊 -
  • 國家政策對基于ajax的web聊天系統設計與實現 -
  • 關于一年級體育課的優秀教案參考[三篇] -