色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美15最新在线-色哟哟免费在线观看-国产l精品国产亚洲区在线观看-国产l精品国产亚洲区久久

0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

第四講:單片機STC89C52+RA8889驅動控制彩屏 代碼移植范例(包含API接口)

harchy ? 來源:harchy ? 作者:harchy ? 2024-06-06 13:59 ? 次閱讀

51單片機驅動控制彩屏系列講座

第四講:單片機STC89C52+RA8889驅動控制彩屏 代碼移植范例(包含API接口

本次介紹單片機STC89C52+RA8889代碼移植范例,該范例已將RA8889的API移植好了,下方提供下載地址。

硬件平臺:89C52+RA8889 采用SPI通信方式 (已測試通過)
微信圖片_20240606135356.jpg

上一講已經闡述RA8889移植到51單片機的基本方法,本講增加了API接口函數的移植,將RA8889_API_51.c添加到工程:
RA8889_API_51.png

API接口將底層代碼經過二次封裝,API代碼為開源,用戶可以進函數查看具體的操作。

1. 數據直接寫顯存

void MPU8_8bpp_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned char *data_array);
void MPU8_16bpp_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned char *data_array);
void MPU8_24bpp_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned char *data_array);
void MPU16_16bpp_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned short *data_array);
void MPU16_24bpp_Mode1_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned short *data_array);
void MPU16_24bpp_Mode2_Memory_Write (unsigned short x,unsigned short y,unsigned short w ,unsigned short h ,const unsigned short *data_array);

2. PIP畫中畫開窗口:可以開2個窗口

void PIP(unsigned char On_Off, unsigned char Select_PIP,unsigned long PAddr,unsigned short XP,unsigned short YP,unsigned long ImageWidth,unsigned short X_Dis,unsigned short Y_Dis,unsigned short X_W,unsigned short Y_H);

3. 顯示文字:包含RA8889內建ASCII,外接集通字庫的顯示

void Print_Internal_Font_Hexvariable(unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,  unsigned int tmp2);
void Print_Internal_Font_Decimalvariable(unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,unsigned int tmp2);
void Print_Internal_Font_String(unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor, char tmp2[]);
void Print_BIG5String(unsigned char Clk ,unsigned char BUS,unsigned char SCS,unsigned short x ,unsigned short y ,unsigned short X_W ,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,char *tmp2);
void Print_GB2312String(unsigned char Clk,unsigned char BUS,unsigned char SCS,unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,char *tmp2);
void Print_GB12345String(unsigned char Clk,unsigned char BUS,unsigned char SCS,unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,char tmp2[]);
void Print_UnicodeString(unsigned char Clk,unsigned char BUS,unsigned char SCS,unsigned short x,unsigned short y,unsigned short X_W,unsigned short Y_H,unsigned long FontColor,unsigned long BackGroundColor,unsigned short *tmp2);
void Select_Font_Height_WxN_HxN_ChromaKey_Alignment(unsigned char Font_Height,unsigned char XxN,unsigned char YxN,unsigned char ChromaKey,unsigned char Alignment);
void Show_String(char *str);

4. 繪圖:各種幾何圖形(硬件實現,高速)

void Draw_Line(unsigned long LineColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);
void Draw_Triangle(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3);
void Draw_Triangle_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short X3,unsigned short Y3);
void Draw_Circle(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short R);
void Draw_Circle_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short R);
void Draw_Ellipse(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Ellipse_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Left_Up_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Left_Up_Curve_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Down_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Down_Curve_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Up_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Right_Up_Curve_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Left_Down_Curve(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Left_Down_Curve_Fill(unsigned long ForegroundColor,unsigned short XCenter,unsigned short YCenter,unsigned short X_R,unsigned short Y_R);
void Draw_Square(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);
void Draw_Square_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2);
void Draw_Circle_Square(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short R,unsigned short Y_R);
void Draw_Circle_Square_Fill(unsigned long ForegroundColor,unsigned short X1,unsigned short Y1,unsigned short X2,unsigned short Y2,unsigned short R,unsigned short Y_R);

5. 內存操作:復制、運算、剔除底色、單色延展彩色、淡入淡出(硬件實現,快速)

void BTE_Memory_Copy(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H);
void BTE_Memory_Copy_Chroma_key(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned long Background_color,unsigned short X_W,unsigned short Y_H);
void BTE_MCU_Write_MCU_8bit(unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H,const unsigned char *data_array);
void BTE_MCU_Write_MCU_16bit(unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H,const unsigned short *data_array);
void BTE_MCU_Write_Chroma_key_MCU_8bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned long Background_color,unsigned short X_W,unsigned short Y_H,const unsigned char *data_array);
void BTE_MCU_Write_Chroma_key_MCU_16bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned long Background_color,unsigned short X_W,unsigned short Y_H,const unsigned short *data_array);
void BTE_Memory_Copy_ColorExpansion(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,unsigned long Background_color);
void BTE_Memory_Copy_ColorExpansion_Chroma_key(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color);
void BTE_MCU_Write_ColorExpansion_MCU_8bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,unsigned long Background_color,const unsigned char *data_array);
void BTE_MCU_Write_ColorExpansion_MCU_16bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,unsigned long Background_color,const unsigned short *data_array);
void BTE_MCU_Write_ColorExpansion_Chroma_key_MCU_8bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,const unsigned char *data_array);
void BTE_MCU_Write_ColorExpansion_Chroma_key_MCU_16bit(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned long Foreground_color,const unsigned short *data_array);
void BTE_Pattern_Fill(unsigned char P_8x8_or_16x16, unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned short X_W,unsigned short Y_H);
void BTE_Pattern_Fill_With_Chroma_key(unsigned char P_8x8_or_16x16 ,unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned int ROP_Code,unsigned long Background_color,unsigned short X_W,unsigned short Y_H);
void BTE_Solid_Fill(unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned long Foreground_color,unsigned short X_W,unsigned short Y_H);
void BTE_Alpha_Blending_Picture_Mode(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H,unsigned char alpha);

6. PWM輸出:RA8889內建2個PWM發生器,可用于調整背光亮度等

void PWM0(unsigned char on_off, unsigned char Clock_Divided, unsigned char Prescalar, unsigned short Count_Buffer,unsigned short Compare_Buffer);
void PWM1(unsigned char on_off, unsigned char Clock_Divided, unsigned char Prescalar, unsigned short Count_Buffer,unsigned short Compare_Buffer);

7. DMA功能,快速顯示圖片(JPG,BMP),播放AVI影片

void DMA_24bit(unsigned char Clk ,unsigned short X1,unsigned short Y1,unsigned short X_W,unsigned short Y_H ,unsigned short P_W ,unsigned long Addr);
void DMA_32bit(unsigned char Clk ,unsigned short X1,unsigned short Y1,unsigned short X_W,unsigned short Y_H ,unsigned short P_W,unsigned long Addr);
void switch_24bits_to_32bits(unsigned char BUS,unsigned char SCS);

void SPI_NOR_Flash_switch_QUAD_MODE(unsigned char BUS,unsigned char SCS,unsigned char flash);
void SPI_NOR_initial_DMA (unsigned char mode,unsigned char BUS,unsigned char SCS,unsigned char flash,unsigned char addr_24b_32b);
void SPI_NOR_initial_JPG_AVI (unsigned char flash,unsigned char addr_24b_32b,unsigned char BUS,unsigned char SCS,unsigned char SCK_Divide);
void SPI_NOR_DMA_png (unsigned long dma_page_addr,unsigned long pic_buffer_Layer,unsigned long Show_pic_Layer,unsigned int picture_Width,unsigned int picture_Height);

void JPG_NOR (unsigned long addr,unsigned long JPGsize,unsigned long IDEC_canvas_width,unsigned short x,unsigned short y);
void AVI_NOR(unsigned long addr,unsigned long videosize,unsigned long shadow_buffer_addr,unsigned long PIP_buffer_addr,unsigned long x,unsigned long y,unsigned long height,unsigned long width,unsigned long PIP_width);

void BTE_alpha_blending_32bit_Pixel_mode(unsigned int picture_Width,unsigned int BTE_X,unsigned int BTE_Y,unsigned long S0X,unsigned long S0Y,unsigned long S0_Start_Addr,unsigned long S0_canvas_width,unsigned long desX,unsigned long desY,unsigned long DES_Start_Addr,unsigned long DES_canvas_width,unsigned long pic_buffer_Layer);
void BTE_alpha_blending_24bit_Pixel_mode(unsigned long S0_Addr,unsigned short S0_W,unsigned short XS0,unsigned short YS0,unsigned long S1_Addr,unsigned short S1_W,unsigned short XS1,unsigned short YS1,unsigned long Des_Addr,unsigned short Des_W, unsigned short XDes,unsigned short YDes,unsigned short X_W,unsigned short Y_H);


void AVI_window(unsigned char ON_OFF);

由于89C52的RAM較小,許多API會占用較多資源,因此可能跑不開,故先演示以下三個常用的功能:

Introduction();                               //文字介紹
Geometry_Demo();                        //幾何繪圖演示
Show_JPG();                                 //調用FLASH的JPG圖片顯示

演示視頻
演示min.gif

移植參考代碼:
*附件:STC89C52_RA8889_SPI4_v1.1.zip

審核編輯 黃宇

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。 舉報投訴
  • 單片機
    +關注

    關注

    6035

    文章

    44554

    瀏覽量

    634640
  • 接口
    +關注

    關注

    33

    文章

    8575

    瀏覽量

    151015
  • API
    API
    +關注

    關注

    2

    文章

    1499

    瀏覽量

    61962
  • 驅動控制
    +關注

    關注

    0

    文章

    121

    瀏覽量

    15751
  • 代碼移植
    +關注

    關注

    0

    文章

    6

    瀏覽量

    6905
收藏 人收藏

    評論

    相關推薦

    第五:51單片機+RA8889驅動控制彩屏 完整源碼說明 【 源碼v1.2 】

    51單片機驅動控制彩屏系列講座 硬件:STC89C52 + RA8889開發板 + TFT
    發表于 06-13 17:23

    51單片機STC8H8K64U通過RA8889/RA8876如何控制彩屏(SPI源碼下載)

    /RA8876控制芯片剛好可以完美搭配用于工控、醫療等各個領域。我們這樣接線就可以了: 二、SPI-4連接電路圖: RA8889單片機接口
    發表于 06-26 14:13

    51單片機(STC8051U34K64)_RA8889_SPI4參考代碼(v1.3)

    文章導引: (1)51單片機(STC8051U34K64)_RA8889_SPI4參考代碼(v1.3) (2)51單片機
    發表于 07-05 10:55

    51單片機(STC8H8K64U/STC8051U34K64)_RA8889_HW_SPI4參考代碼(v1.3) 硬件SPI方式驅動大屏顯示

    文章導引: (1)51單片機(STC8051U34K64)_RA8889_SPI4參考代碼(v1.3) (2)51單片機
    發表于 07-17 11:15

    單片機驅動彩屏最簡方案:單片機_RA8889最小開發板驅動控制TFT彩屏介紹(一)

    本文介紹使用單片機+RA8889驅動控制彩屏的最小方案。文章從RA8889的架構功能、硬件電
    發表于 08-22 17:31

    基于STC89C52單片機控制的溫度控制系統課程設計

    基于STC89C52單片機控制的溫度控制系統
    發表于 01-06 17:00 ?152次下載

    單片機STC89C52程序

    單片機STC89C52源程序。
    發表于 01-11 18:16 ?112次下載

    STC89C52單片機介紹

    STC89C52單片機介紹。
    發表于 05-20 13:55 ?257次下載

    STC89C52單片機內部EEPROM驅動的使用源代碼免費下載

    本文檔的主要內容詳細介紹的是STC89C52單片機內部EEPROM驅動的使用源代碼免費下載。
    發表于 09-11 17:23 ?4次下載
    <b class='flag-5'>STC89C52</b><b class='flag-5'>單片機</b>內部EEPROM<b class='flag-5'>驅動</b>的使用源<b class='flag-5'>代碼</b>免費下載

    基于單片機STC89C52控制的智能小車簡介

    基于單片機STC89C52控制的智能小車簡介(單片機原理圖)-該文檔為基于單片機STC89C52
    發表于 07-22 14:21 ?68次下載
    基于<b class='flag-5'>單片機</b><b class='flag-5'>STC89C52</b><b class='flag-5'>控制</b>的智能小車簡介

    STC89C52單片機器件手冊

    STC89C52系列單片機的內部結構框圖如下圖所示。STC89C52單片機包含中央處理器(CPU)、程序存儲器(Flash)、數據存儲器(
    發表于 09-05 10:41 ?8次下載

    第一單片機STC89C52+RA8889驅動控制彩屏 極簡方案(源碼公開)

    本章介紹如何使用51單片機驅動控制彩屏,控制器彩用瑞佑的RA8889,通信方式采用SPI-4線
    的頭像 發表于 06-04 08:45 ?687次閱讀
    第一<b class='flag-5'>講</b>:<b class='flag-5'>單片機</b><b class='flag-5'>STC89C52+RA8889</b><b class='flag-5'>驅動</b><b class='flag-5'>控制</b><b class='flag-5'>彩屏</b> 極簡方案(源碼公開)

    第二單片機STC89C52+RA8889驅動控制彩屏 代碼移植介紹

    介紹51單片機如何移植RA8889代碼進行彩屏驅動控制
    的頭像 發表于 06-04 10:36 ?955次閱讀
    第二<b class='flag-5'>講</b>:<b class='flag-5'>單片機</b><b class='flag-5'>STC89C52+RA8889</b><b class='flag-5'>驅動</b><b class='flag-5'>控制</b><b class='flag-5'>彩屏</b> <b class='flag-5'>代碼</b><b class='flag-5'>移植</b>介紹

    第三單片機STC89C52+RA8889驅動控制彩屏 代碼的壓縮(Keil編譯器)

    51單片機驅動控制芯片RA8889,源代碼函數冗余較多,移植時可能會碰到輸出程序過大,這里介紹壓
    的頭像 發表于 06-05 11:05 ?544次閱讀
    第三<b class='flag-5'>講</b>:<b class='flag-5'>單片機</b><b class='flag-5'>STC89C52+RA8889</b><b class='flag-5'>驅動</b><b class='flag-5'>控制</b><b class='flag-5'>彩屏</b> <b class='flag-5'>代碼</b>的壓縮(Keil編譯器)

    51單片機STC8H8K64U通過RA8889/RA8876如何控制彩屏 I2C源碼下載

    用51單片機STC8H8K64U驅動彩屏控制器采用瑞佑RA8889. 使用軟件模擬I2
    的頭像 發表于 11-01 11:02 ?416次閱讀
    51<b class='flag-5'>單片機</b><b class='flag-5'>STC</b>8H8K64U通過<b class='flag-5'>RA8889</b>/<b class='flag-5'>RA</b>8876如何<b class='flag-5'>控制</b><b class='flag-5'>彩屏</b> I2<b class='flag-5'>C</b>源碼下載
    主站蜘蛛池模板: 中文字幕在线观看国产| 成人小视频在线观看| 青青伊人国产| 久久精品国产在热亚洲完整版| thermo脱色摇床安卓下载| 亚洲免费视频网站| 日韩精品免费一区二区| 暖暖日本在线手机免费完整版 | 日日碰狠狠添天天爽| 免费被靠视频动漫| 伦理片97影视网| 久久无码AV亚洲精品色午夜麻豆| 精品九九视频| 国精产品999一区二区三区有限| 大胸美女被c| 国产传媒在线播放| 俄罗斯黄色大片| 国产3级在线观看| 国产69精品久久久久麻豆| 国产 浪潮AV性色四虎| 国产精品成人观看视频免费| 国产成人国产在线观看入口 | 国产精品麻豆a在线播放| 国产精品第一综合首页| 漂亮的av女演员| 內射XXX韩国在线观看| 色橹橹欧美在线观看视频高清 | 特污兔午夜影视院| 新版孕妇bbwbbwbbw| 亚洲合集综合久久性色| 亚洲区欧美日韩综合| 真实的强视频免费网站| 18亚洲男同gay1069| 成人无码国产AV免费看| 国产在线一卡二卡| 久久久久亚洲精品影视| 日韩精品熟女一区二区三区中文| 午夜熟女插插XX免费视频| 2021乱码精品公司| 国产对白精品刺激一区二区| 精子网久久国产精品|