99热成人精品热久久6网站_无码中文亚洲AV吉吉影音_国产精品制服一区二区_中文字幕乱码一区二区三区免费

首頁 > 技術(shù)支持 > 應(yīng)用與案例 > 正文
第九講 單片機驅(qū)動彩色液晶屏 控制RA8889軟件:認(rèn)識顯存 作者:BW.SU   發(fā)表日期:2024-01-16   來源:菱致電子   瀏覽:
目錄
第六講 單片機驅(qū)動彩色液晶屏 控制RA8889軟件:顯示文字:Part2.外接字庫
第七講 單片機驅(qū)動彩色液晶屏 控制RA8889軟件:顯示文字:Part3.自建字庫
第八講 單片機驅(qū)動彩色液晶屏 控制RA8889軟件:顯示圖片
第九講 單片機驅(qū)動彩色液晶屏 控制RA8889軟件:認(rèn)識顯存并進(jìn)行讀、寫、復(fù)制
第十講 單片機驅(qū)動彩色液晶屏 控制RA8889軟件:圖像運算
第十一講 單片機驅(qū)動彩色液晶屏 控制RA8889軟件:播放avi視頻
第十二講 單片機驅(qū)動彩色液晶屏 如何打包bin檔
第十三講 單片機驅(qū)動彩色液晶屏 bin檔的燒錄方法


RA8889內(nèi)建128Mb顯存;RA8876有兩種,一種內(nèi)建64Mb顯存,另一種是外擴自己加SDRAM,內(nèi)建或者外擴硬件上兼容,可靈活選用。

一、分辨率與顯存的關(guān)系

舉例來說明比較容易理解,比如800x480的分別率,要求顯示16位色深,那么顯存要求是:800x480*16/8=768000(Bytes);如果要求顯示的是24位色,那么顯存要求是:800x480x24/8=1152000(Bytes)。

RA8889內(nèi)建128Mb顯存,即128/8=16MBytes,用在800x480@16位色,顯示緩沖區(qū)為:16x1024/768≈21個;用在800x480@24位色,顯示緩沖區(qū)為:16x1024/1152≈14個。

二、畫布圖像寬度、主圖像寬度和活動窗口
 

  • 畫布圖像寬度(Canvas Image Width),是將顯存規(guī)劃出最大寬度,寬度一般設(shè)定為屏寬的倍數(shù)。用戶必須配置畫布圖像寬度以確定圖像大小,并在將數(shù)據(jù)寫入圖像緩沖區(qū)之前配置活動窗口(Active_Window)范圍。
  • 主圖像寬度(Main Image Width),規(guī)劃出顯示緩存寬度,這個值設(shè)定和畫布圖像寬度(Canvas Image Width)一樣即可。通過設(shè)定Main_Window_Start_XY坐標(biāo),定位當(dāng)前顯示窗口要顯示哪個區(qū)域的圖像。
  • 活動窗口(Active_Window),在圖層范圍內(nèi)規(guī)劃一個區(qū)域用于寫入數(shù)據(jù),需要設(shè)定坐標(biāo)和寬、高參數(shù)。
下圖舉例,假設(shè)液晶屏寬是800,畫布圖像寬度和主圖寬度均設(shè)為1600,顯示區(qū)域可以任意指定的,活動區(qū)域也可以任意指定的。


三、主要調(diào)用以下API函數(shù):

    Canvas_Image_Start_address(0);       //**[50h][51h][52h][53h]**//
    Canvas_image_width(canvas_image_width);  //**[54h][55h]**//
    Main_Image_Start_Address(0);    //**[20h][21h][22h][23h]**//
    Main_Image_Width(main_image_width);   //**[24h][25h]**//
    Main_Window_Start_XY(0, 0);        //**[26h][27h][28h][29h]**//
    Active_Window_XY(0, 0);         //**[56h][57h][58h][59h]**//
    Active_Window_WH(LCD_Width, LCD_Height);    //**[5Ah][5Bh][5Ch][5Dh]**//


四、SDRAM的讀寫
 

  • 寫點函數(shù):

// Write pixel to SDRAM
// Not support MCU_16bit_ColorDepth_24bpp_Mode_1
void putPixel(
    unsigned short x // x of coordinate
    ,
    unsigned short y // y of coordinate
    ,
    unsigned long color
    /*color :
    8bpp:R3G3B2
    16bpp:R5G6B5
    24bpp:R8G8B8
    */
)
{
    Goto_Pixel_XY(x, y);
    LCD_CmdWrite(0x04);
    Check_Mem_WR_FIFO_not_Full();

#ifdef MCU_8bit_ColorDepth_8bpp
    LCD_DataWrite(color);
#endif
#ifdef MCU_8bit_ColorDepth_16bpp
    LCD_DataWrite(color);
    Check_Mem_WR_FIFO_not_Full();
    LCD_DataWrite(color >> 8);
#endif
#ifdef MCU_8bit_ColorDepth_24bpp
    LCD_DataWrite(color);
    Check_Mem_WR_FIFO_not_Full();
    LCD_DataWrite(color >> 8);
    Check_Mem_WR_FIFO_not_Full();
    LCD_DataWrite(color >> 16);
#endif
#ifdef MCU_16bit_ColorDepth_16bpp
    LCD_DataWrite(color);
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_2
    LCD_DataWrite(color);
    Check_Mem_WR_FIFO_not_Full();
    LCD_DataWrite(color >> 16);
#endif
}

 

  • 讀點函數(shù):

// Read pixel from SDRAM
// Not support MCU_16bit_ColorDepth_24bpp_Mode_1
unsigned long ReadPixel(
    unsigned int x // x of coordinate
    ,
    unsigned int y // y of coordinate
    /*color :
 8bpp:R3G3B2
    16bpp:R5G6B5
    24bpp:R8G8B8
 */
)
{
    unsigned long tmp;
    Check_2D_Busy();
    Goto_Pixel_XY(x, y);
    LCD_CmdWrite(0x04);
    LCD_DataRead(); // need a nop before reading data
    Check_Mem_RD_FIFO_not_Empty();

#ifdef MCU_8bit_ColorDepth_8bpp
    tmp = LCD_DataRead();
#endif
#ifdef MCU_8bit_ColorDepth_16bpp
    LCD_DataRead(); // need a nop before reading data
    tmp = LCD_DataRead();
    tmp = tmp << 8;
    tmp += LCD_DataRead();
#endif
#ifdef MCU_8bit_ColorDepth_24bpp
    tmp = LCD_DataRead();
    tmp += LCD_DataRead() << 8;
    tmp += LCD_DataRead() << 16;
#endif
#ifdef MCU_16bit_ColorDepth_16bpp
    LCD_DataRead(); // need a nop before reading data
    tmp = LCD_DataRead();
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_2
    tmp = LCD_DataRead();
    tmp += LCD_DataRead() << 16;
#endif

    Check_Mem_RD_FIFO_Full();

    return tmp;
}


不同色深定義,數(shù)據(jù)的存放格式不同,故讀寫顯存時需要根據(jù)色深定義區(qū)別操作,詳細(xì)數(shù)據(jù)格式在此不展開說明,詳細(xì)請參考RA8889/RA8876的規(guī)格書。
 

第九講 THE END


分享到:

相關(guān)熱詞搜索:RA8889 RA8876 單片機 驅(qū)動 彩屏

上一篇:第八講 單片機驅(qū)動彩色液晶屏 控制RA8889軟件:顯示圖片
下一篇:第十講 單片機驅(qū)動彩色液晶屏 控制RA8889軟件:圖像運算

>>延伸閱讀:0

  • · 如何解決MCU與RA8889等液晶控制芯片的SPI通信問題 [2020-03-04]
  • · RA8889配套上位機使用簡介 [2020-09-01]
  • · 介紹一顆51單片機就可以進(jìn)行視頻解碼的芯片方案1366x768 [2020-09-07]
  • · RA88xx系列對顯存直接讀寫點的方法 [2020-09-10]
  • · NAND FLASH的調(diào)用 [2020-09-14]