本文介紹用戶自己生成的ASCII字庫如何通過RA8889/RA8876顯示到液晶屏上。
先上一張實例效果圖:
再上程序代碼:int main(void)
{
unsigned short x,y;
/* System Clocks Configuration */
RCC_Configuration();
delay_init(72);
GPIO_Configuration();
//NVIC_Configuration();
//SPI_Peripheral_Init();
/* Enable the FSMC Clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
delay_ms(1);
FSMC_LCD_Init_H();/*RA8889初始化*/
RA8889_Initial();
/*清屏,填充黑色0x0*/
BTE_Solid_Fill(0,canvas_image_width,0,0,0x0,LCD_Width,LCD_Height);
/*MCU寫入ASCII字符功能例程測試,不支持MCU_16bit_ColorDepth_24bpp_Mode_1 */
x=30;
y=50;
lcdPutString8x12(x,y,color65k_black,color65k_yellow,0,"The things I want to know are in books, my best friend is the man ");
lcdPutString16x24(x,y+20,color65k_black,color65k_yellow,0,"who'll get me a book I ain't read.");
lcdPutString16x24(x+16*14,y+50,color65k_green,color65k_yellow,1," --Abraham Lincoln ");
lcdPutString32x48(x,y+100,color65k_white,color65k_yellow,1,"ASCII font lib is ");
lcdPutString32x48(x,y+150,color65k_white,color65k_yellow,1,"stored in the MCU's");
lcdPutString32x48(x,y+200,color65k_white,color65k_yellow,1,"FLASH.");while(1);
}
程序流程圖:
該方法是將制作好的ASCII字庫放在MCU的FLASH中進行引用,字符數(shù)量為95個,編碼區(qū)間0x20~0x7E,通過編碼即可索引,并調(diào)用相應(yīng)的數(shù)據(jù),通過RA8889/RA8876描點顯示出來。
↓↓↓↓↓↓ 底部提供源程序下載。 ↓↓↓↓↓↓
分享到: