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

首頁 > 技術(shù)支持 > 應(yīng)用與案例 > 正文
單片機(jī)圖形控制芯片RA8889系列介紹(四)——軟件篇 作者:Harchy   發(fā)表日期:2021-02-05   來源:菱致電子   瀏覽:



上一節(jié)我主要介紹了單片機(jī)通過RA8889來點(diǎn)液晶屏的硬件結(jié)構(gòu),接下來開始講解軟件部份如何設(shè)計。

瑞佑(RAIO)的RA8875當(dāng)前已經(jīng)擁有相當(dāng)巨大的用戶群,一個最重要的原因是其軟件代碼特別容易寫,而RA8889也一樣,功能上比RA8875更強(qiáng)大但是軟件代碼一樣簡單,而且還會更容易!

列舉:main.c
#include
#include
#include
 
#include "delay.h"
 
//Include RAiO files
#include "UserDef.h"
#include "RA8889_MCU_IF.h"
#include "RA8889.h"
#include "RA8889_API.h"
#include "API_Demo.h"
 
int main(void)
{
RA8889_Initial(); //RA8889初始化
BTE_Solid_Fill(0,4800,0,0,0x000000,800,480); //內(nèi)存清空,填充
while(1)
{
NOR_AVI_Demo(); //執(zhí)行AVI播放演示
}
}
 
RA8889_Initial() 初始化函數(shù)
//==============================================================================
void RA8889_Initial(void)
{
#ifdef Parallel_8080 
/* using STM32 FSMC Interface*/ 
#endif
 
#ifdef Parallel_6800
Parallel_6800_ini();
#endif
 
#ifdef Serial_I2C
I2C_Initial();        
#endif
 
#ifdef Serial_4
SPI4_Init();
#endif
 
#ifdef Serial_3
SPI3_Init();
#endif
 
 
//------------------------------------
RA8889_HW_Reset();
Check_IC_ready();
// System_Check_Temp();  
 
 
RA8889_SW_Reset();
Check_IC_ready();
 
 
//------------------------------------
RA8889_PLL(DRAM_FREQ, CORE_FREQ, SCAN_FREQ);
 
//------------------------------------
RA8889_SDRAM_initial();// set the SDRAM parameter.  
//------------------------------------
 
//**[01h]**//
TFT_24bit();
// TFT_18bit();
// TFT_16bit();
// Without_TFT();
 
//**[01h]**//
#if defined (MCU_8bit_ColorDepth_8bpp) || defined (MCU_8bit_ColorDepth_16bpp) || defined (MCU_8bit_ColorDepth_24bpp)
Host_Bus_8bit();
#endif
 
#if defined (MCU_16bit_ColorDepth_16bpp) || defined (MCU_16bit_ColorDepth_24bpp_Mode_1) || defined (MCU_16bit_ColorDepth_24bpp_Mode_2)
Host_Bus_16bit();
#endif
 
 
//------------------------------------
//**[02h]**//
#ifdef MCU_8bit_ColorDepth_8bpp
Data_Format_8b_8bpp();
#endif
#ifdef MCU_8bit_ColorDepth_16bpp
Data_Format_8b_16bpp();
#endif
#ifdef MCU_8bit_ColorDepth_24bpp
Data_Format_8b_24bpp();
#endif
 
#ifdef MCU_16bit_ColorDepth_16bpp
Data_Format_16b_16bpp();
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_1
Data_Format_16b_24bpp_mode1();
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_2
Data_Format_16b_24bpp_mode2();
#endif
 
 
MemWrite_Left_Right_Top_Down();//(Default) Memory Write: Left to Right, Top to Down.
 
//------------------------------------
//**[03h]**//
 
Graphic_Mode();
// Text_Mode();
 
Memory_Select_SDRAM();
 
//------------------------------------
//** Set color depth, define in [UserDef.h] **//
 
#ifdef MCU_8bit_ColorDepth_8bpp
Select_Main_Window_8bpp(); //[10h] Set main window color depth
Memory_8bpp_Mode(); //[5Eh] Set active memory color depth
 
Select_PIP1_Window_8bpp(); //[11h] PIP 1 Window Color Depth
Select_PIP2_Window_8bpp(); //[11h] PIP 2 Window Color Depth
 
BTE_S0_Color_8bpp(); //[92h] Source_0 Color Depth
BTE_S1_Color_8bpp(); //[92h] Source_1 Color Depth
BTE_Destination_Color_8bpp(); //[92h] Destination Color Depth
 
IDEC_Destination_Color_8bpp();//
#endif
 
#if defined (MCU_8bit_ColorDepth_16bpp) || defined (MCU_16bit_ColorDepth_16bpp)
Select_Main_Window_16bpp(); //[10h]Set main window color depth
Memory_16bpp_Mode(); //[5Eh]Set active memory color depth
 
Select_PIP1_Window_16bpp(); //[11h] PIP 1 Window Color Depth
Select_PIP2_Window_16bpp(); //[11h] PIP 2 Window Color Depth
 
BTE_S0_Color_16bpp(); //[92h] Source_0 Color Depth
BTE_S1_Color_16bpp(); //[92h] Source_1 Color Depth
BTE_Destination_Color_16bpp(); //[92h] Destination Color Depth
 
IDEC_Destination_Color_16bpp();//
#endif
 
#if defined (MCU_8bit_ColorDepth_24bpp) || defined (MCU_16bit_ColorDepth_24bpp_Mode_1) || defined (MCU_16bit_ColorDepth_24bpp_Mode_2)
Select_Main_Window_24bpp(); //[10h]Set main window color depth
Memory_24bpp_Mode(); //[5Eh]Set active memory color depth
 
Select_PIP1_Window_24bpp(); //[11h] PIP 1 Window Color Depth
Select_PIP2_Window_24bpp(); //[11h] PIP 2 Window Color Depth
 
BTE_S0_Color_24bpp(); //[92h] Source_0 Color Depth
BTE_S1_Color_24bpp(); //[92h] Source_1 Color Depth
BTE_Destination_Color_24bpp(); //[92h] Destination Color Depth    
 
IDEC_Destination_Color_24bpp();//
#endif
 
//------------------------------------
//**[12h]~[1Fh]]**//
Set_LCD_Panel(); // define in [UserDef.h]
 
//------------------------------------
//**[20h][21h][22h][23h]**//
Main_Image_Start_Address(0);
//**[24h][25h]**//
Main_Image_Width(main_image_width);
//**[26h][27h][28h][29h]**//
Main_Window_Start_XY(0,0);
//**[50h][51h][52h][53h]**//
Canvas_Image_Start_address(0);
//**[54h][55h]**//
Canvas_image_width(canvas_image_width);
//**[56h][57h][58h][59h]**//
Active_Window_XY(0,0);
//**[5Ah][5Bh][5Ch][5Dh]**//
Active_Window_WH(LCD_width,LCD_legth);
 
//------------------------------------
//**[5E]**//
Memory_XY_Mode();
// Memory_Linear_Mode();
 
 
//------------------------------------
Set_Serial_Flash_IF();
 
//------------------------------------
//**[5Fh][60h][61h][62h]**//
Goto_Pixel_XY(0,0);    
 
//------------------------------------  
 
//---------------------//
Display_ON();
//---------------------//
//Color_Bar_ON();
//delay_seconds(1);
//Color_Bar_OFF();
}
BTE_Solid_Fill() 顏色填充函數(shù):
void BTE_Solid_Fill
(
unsigned long Des_Addr //start address of destination 
,unsigned short Des_W // image width of destination (recommend = canvas image width) 
, unsigned short XDes //coordinate X of destination 
,unsigned short YDes //coordinate Y of destination 
,unsigned long Foreground_color //Solid Fill color
,unsigned short X_W //Width of BTE Window
,unsigned short Y_H //Length of BTE Window 
)
{
 
#ifdef MCU_8bit_ColorDepth_8bpp
  Foreground_color_256(Foreground_color);
#endif
#ifdef MCU_8bit_ColorDepth_16bpp
  Foreground_color_65k(Foreground_color);
#endif
#ifdef MCU_8bit_ColorDepth_24bpp
  Foreground_color_16M(Foreground_color);
#endif
 
#ifdef MCU_16bit_ColorDepth_16bpp
  Foreground_color_65k(Foreground_color);
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_1
  Foreground_color_16M(Foreground_color);
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_2
  Foreground_color_16M(Foreground_color);
#endif
  BTE_Destination_Memory_Start_Address(Des_Addr);
  BTE_Destination_Image_Width(Des_W);
  BTE_Destination_Window_Start_XY(XDes,YDes);
  BTE_Window_Size(X_W,Y_H);
  BTE_Operation_Code(0x0c); //BTE Operation: Solid Fill (w/o ROP)
  BTE_Enable();
  Check_BTE_Busy();  
}
 
NOR_AVI_Demo() 播放AVI影片函數(shù):

void NOR_AVI_Demo(void)

{
unsigned char temp;
SPI_NOR_initial_JPG_AVI (1,0,1,2,1);
AVI_NOR(1296674,13327214,shadow_buff,shadow_buff+2400,0,0,322,548,canvas_image_width);
AVI_window(1);
 
do{
temp = Read_Media_Decode_Busy(); //read busy flag to know media decode busy or idle
}while(temp&0x40);
AVI_window(0);
}
瑞佑(RAIO)的工程師們已經(jīng)化繁為簡,所有功能都打包成API函數(shù)了,簡單明了,用戶不需要去查閱繁瑣的寄存器功能,相信這一點(diǎn)足以減少巨大的UI開發(fā)時間。

瑞佑(RAIO)的API包含描點(diǎn)、幾何繪圖、文字顯示、圖形運(yùn)算(BTE邏輯運(yùn)算)、DMA調(diào)圖顯示以及AVI影片播放等等各種功能,可以滿足人機(jī)交互的所有界面設(shè)計需求。

許多單片機(jī)自帶TFT液晶控制器,那種方案正常要結(jié)合GUI來設(shè)計界面,是直接描點(diǎn)顯示,界面圖形都是通過軟件來完成,在許多情況下顯示速度就會慢一些了,而這點(diǎn)在RA8889上就可以得到克服,哪怕您使用的只是一顆51單片機(jī),顯示速度一樣十分迅速,因為這顆芯片內(nèi)部是通過硬件來完成圖形驅(qū)動控制的。


看到這里,相信許多工程師已對這顆芯片的軟件設(shè)計理解了一大半了??赡艽蠹疫€有個疑問,液晶屏型號那么多,初始化肯定各有所異,如何設(shè)置呢?頭大!這個也要告訴大家放心吧!瑞佑(RAIO)已經(jīng)將常用的型號都建庫了,您不需要擔(dān)心直接拿來用再慢慢細(xì)調(diào),若有問題也可以向原廠詢求技術(shù)支持,難度很??!

液晶屏參數(shù)定義舉例:AT070TN92
#ifdef AT070TN92
 
//**[10h]**//
Select_LCD_Sync_Mode(); // Enable XVSYNC, XHSYNC, XDE.
// Select_LCD_DE_Mode(); // XVSYNC & XHSYNC in idle state.
 
PCLK_Falling();
//PCLK_Rising();
 
VSCAN_T_to_B();
PDATA_Set_RGB();
 
HSYNC_Low_Active();
VSYNC_Low_Active();
DE_High_Active();
//DE_Low_Active();
 
LCD_HorizontalWidth_VerticalHeight(800,480);//INNOLUX 800x480?
 
/* [16h][17h] : Figure 19-3 [HND] Non Display or Back porch (pixels) = (HNDR + 1) * 8 + HNDFTR  
[18h] : Figure 19-3 [HST] Start Position or Front porch (pixels) = (HSTR + 1)x8
[19h] : Figure 19-3 [HPW] Pulse Width(pixels) = (HPW + 1)x8
*/
LCD_Horizontal_Non_Display(38);//INNOLUX800x600,46?
LCD_HSYNC_Start_Position(210);//INNOLUX800x600,16~354?
LCD_HSYNC_Pulse_Width(8);//INNOLUX800x600,1~40C
 
/* [1Ch][1Dh] : Figure 19-3 [VND] Non-Display Period(Line) = (VNDR + 1)
[1Eh] : Figure 19-3 [VST] Start Position(Line) = (VSTR + 1)
[1Fh] : Figure 19-3 [VPW] Pulse Width(Line) = (VPWR + 1)
*/
LCD_Vertical_Non_Display(13);//INNOLUX800x600,23?
LCD_VSYNC_Start_Position(22);//INNOLUX800x600,1~147?
LCD_VSYNC_Pulse_Width(10);//INNOLUX800x600,1~20C
 
#endif

到這里,基本就將軟件設(shè)計說明完了,除此而外,瑞佑(RAIO)還新增加了一個上位機(jī)輔助界面設(shè)計工具,研發(fā)在做UI時,可以借助這個工具來開發(fā),可以做到所見即所得的效果,開發(fā)效率極高,這些就留到下一節(jié)再做介紹吧!

分享到:

相關(guān)熱詞搜索:RA8889 AVI JPEG Decorder 解碼 RA8889M

上一篇:單片機(jī)圖形控制芯片RA8889系列介紹(三)——硬件篇
下一篇:TTL轉(zhuǎn)LVDS電路介紹

>>延伸閱讀:0

  • · 單片機(jī)圖形控制芯片RA8889系列介紹(一) [2021-01-22]
  • · 單片機(jī)圖形控制芯片RA8889系列介紹(二) [2021-02-02]
  • · 單片機(jī)圖形控制芯片RA8889系列介紹(三)——硬件篇 [2021-02-03]