找回密码
 立即注册
搜索
热搜: RA8889 RA8876 RA8875
查看: 161|回复: 6

RA8889显示波形问题

[复制链接]

1

主题

3

回帖

43

积分

新手上路

积分
43
发表于 2026-6-15 14:59:50 | 显示全部楼层 |阅读模式
当前使用的硬件是开发板RT8889CNN03+RT32F103

现在想做一个类似示波器的波形显示
想问有没有这种控件或者什么实现方式

71

主题

49

回帖

1555

积分

管理员

积分
1555
QQ
发表于 2026-6-15 15:53:47 | 显示全部楼层
可以看一下你想做什么样的界面?有没有效果图?我们再提供建议。
画曲线的话 一般是通过描点,这是基本的函数,算好坐标直接绘制。
但可能需要开图层,进行处理防止闪烁之类的问题。

1

主题

3

回帖

43

积分

新手上路

积分
43
 楼主| 发表于 2026-6-26 15:55:18 | 显示全部楼层
我简单做了个DEMO,波形是能显示处理出来,但是波形滚动起来会有闪烁,不知道是什么问题。
一开始用了A、B两个缓冲区来做,以为闪烁是在显示B缓冲区时操作bte copy导致的,就又加了两个缓冲区,
来保证显示其中一个缓冲区时,不会涉及当前缓冲区的操作,但还是有闪烁。
以下是我的main函数
  1. int main(void)
  2. {
  3.         /* System Clocks Configuration */
  4.         RCC_Configuration();
  5.         delay_init(72);   
  6.         GPIO_Configuration();       
  7.         NVIC_Configuration();       
  8.         SPI_Peripheral_Init();
  9.     TIM2_Init();
  10.         /* Enable the FSMC Clock */
  11.         RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
  12.         delay_ms(1);
  13.         FSMC_LCD_Init_H();       

  14.     for(i = 0; i<71; i++)
  15.     {
  16.         coordinateX[i] = 50 + i*10;
  17.         coordinateY[i] = i;
  18.     }
  19.         /*RA8889初始化出现彩虹条*/
  20.         RA8889_Initial();
  21.     Enable_Vsync_Interrupt();
  22.     // Page_Render_001();

  23.     /*用黑色背景填充 缓冲区A*/
  24.     BTE_Solid_Fill(bufferA_addr, canvas_image_width, 0, 0, RGB565_black, LCD_width, LCD_legth);
  25.     /*用黑色背景填充 缓冲区B*/
  26.         BTE_Solid_Fill(bufferB_addr, canvas_image_width, 0, 0, RGB565_black, LCD_width, LCD_legth);
  27.     /*用黑色背景填充 缓冲区C*/
  28.     BTE_Solid_Fill(bufferC_addr, canvas_image_width, 0, 0, RGB565_black, LCD_width, LCD_legth);
  29.     /*用黑色背景填充 缓冲区D*/
  30.     BTE_Solid_Fill(bufferD_addr, canvas_image_width, 0, 0, RGB565_black, LCD_width, LCD_legth);
  31.     Canvas_Image_Start_address(bufferA_addr);
  32.     random_num = rand() % 100;
  33.     Draw_Line(RGB565_blue, 0, random_num, 7, 100);
  34.     while(1)
  35.     {

  36.         if(updateCurve == 1)
  37.         {
  38.             updateCurve = 0;

  39.             last_random = random_num;
  40.             random_num = rand() % 100;
  41.             // random_num = cntX*5;
  42.             if(cntX%4 == 0)
  43.             {
  44.                 /*把缓冲区A复制到缓冲区B*/
  45.                 BTE_Memory_Copy(
  46.                     bufferA_addr, //S0 数据源地址,当前显示区
  47.                     800*2,   //S0行宽
  48.                     0, 0,  //S0窗口左上角
  49.                     0,0,0,0, //S1未使用
  50.                     bufferB_addr, //D 目标地址,后台缓冲区
  51.                     800*2,  //D行宽
  52.                     8, 0, //D窗口左上角
  53.                     0x0c,   //ROP = S0 直接复制
  54.                     500,100  //拷贝尺寸
  55.                 );
  56.                 /*在缓冲区B画新线*/
  57.                 Canvas_Image_Start_address(bufferB_addr);
  58.                 Draw_Line(RGB565_blue, 0, random_num, 7, last_random);
  59.                 Check_Vsync_finished();
  60.                 /*显示缓冲区A*/
  61.                 Main_Image_Start_Address(bufferA_addr);
  62.                 /*清缓冲区D*/
  63.                 BTE_Solid_Fill(bufferD_addr, canvas_image_width, 0, 0, RGB565_black, LCD_width, LCD_legth);
  64.             }
  65.             else if(cntX%4 == 1)
  66.             {
  67.                 /*把缓冲区B右移到缓冲区C*/
  68.                 BTE_Memory_Copy(
  69.                     bufferB_addr, //S0 数据源地址,当前显示区
  70.                     800*2,   //S0行宽
  71.                     0, 0,  //S0窗口左上角
  72.                     0,0,0,0, //S1未使用
  73.                     bufferC_addr, //D 目标地址,后台缓冲区
  74.                     800*2,  //D行宽
  75.                     8, 0, //D窗口左上角
  76.                     0x0c,   //ROP = S0 直接复制
  77.                     500,100  //拷贝尺寸
  78.                 );
  79.                 /*在缓冲区C画*/
  80.                 Canvas_Image_Start_address(bufferC_addr);
  81.                 Draw_Line(RGB565_blue, 0, random_num, 7, last_random);
  82.                 Check_Vsync_finished();
  83.                 /*显示缓冲区B*/
  84.                 Main_Image_Start_Address(bufferB_addr);
  85.                 /*清缓冲区A*/
  86.                 BTE_Solid_Fill(bufferA_addr, canvas_image_width, 0, 0, RGB565_black, LCD_width, LCD_legth);
  87.             }
  88.             else if(cntX%4 == 2)
  89.             {
  90.                 /*把缓冲区C 复制到缓冲区D*/
  91.                 BTE_Memory_Copy(
  92.                     bufferC_addr, //S0 数据源地址,当前显示区
  93.                     800*2,   //S0行宽
  94.                     0, 0,  //S0窗口左上角
  95.                     0,0,0,0, //S1未使用
  96.                     bufferD_addr, //D 目标地址,后台缓冲区
  97.                     800*2,  //D行宽
  98.                     8, 0, //D窗口左上角
  99.                     0x0c,   //ROP = S0 直接复制
  100.                     500,100  //拷贝尺寸
  101.                 );
  102.                 /*在缓冲区D画*/
  103.                 Canvas_Image_Start_address(bufferD_addr);
  104.                 Draw_Line(RGB565_blue, 0, random_num, 7, last_random);
  105.                 Check_Vsync_finished();
  106.                 /*显示缓冲区C*/
  107.                 Main_Image_Start_Address(bufferC_addr);
  108.                 /*清缓冲区B*/
  109.                 BTE_Solid_Fill(bufferB_addr, canvas_image_width, 0, 0, RGB565_black, LCD_width, LCD_legth);
  110.             }
  111.             else if(cntX%4 == 3)
  112.             {
  113.                 /*把缓冲区D 复制到缓冲区A*/
  114.                 BTE_Memory_Copy(
  115.                     bufferD_addr, //S0 数据源地址,当前显示区
  116.                     800*2,   //S0行宽
  117.                     0, 0,  //S0窗口左上角
  118.                     0,0,0,0, //S1未使用
  119.                     bufferA_addr, //D 目标地址,后台缓冲区
  120.                     800*2,  //D行宽
  121.                     8, 0, //D窗口左上角
  122.                     0x0c,   //ROP = S0 直接复制
  123.                     500,100  //拷贝尺寸
  124.                 );
  125.                 /*在缓冲区A画*/
  126.                 Canvas_Image_Start_address(bufferA_addr);
  127.                 Draw_Line(RGB565_blue, 0, random_num, 7, last_random);
  128.                 Check_Vsync_finished();
  129.                 /*显示缓冲区D*/
  130.                 Main_Image_Start_Address(bufferD_addr);
  131.                 /*清缓冲区C*/
  132.                 BTE_Solid_Fill(bufferC_addr, canvas_image_width, 0, 0, RGB565_black, LCD_width, LCD_legth);
  133.             }
  134.             cntX++;
  135.             if(cntX == 4)
  136.             {
  137.                 cntX = 0;
  138.             }
  139.         }
  140.         }
  141. }
复制代码

1

主题

3

回帖

43

积分

新手上路

积分
43
 楼主| 发表于 2026-6-26 16:04:00 | 显示全部楼层
这是当前的波形图
111.png

1

主题

3

回帖

43

积分

新手上路

积分
43
 楼主| 发表于 2026-6-26 16:43:12 | 显示全部楼层
updateCurve标志 是开了一个定时器,每50ms置1

9

主题

11

回帖

947

积分

版主

积分
947
发表于 7 天前 | 显示全部楼层
liurui067 发表于 2026-6-26 16:04
这是当前的波形图

这种画直线就可以了,闪烁是重复显示后清除造成得的,两个图层就可以A图层显示B图层缓存操作,B图层操作完复制覆盖到A图层显示。

9

主题

11

回帖

947

积分

版主

积分
947
发表于 7 天前 | 显示全部楼层
参考代码:
void App_Demo_Waveform(void)                                                        //波形绘图演示
{
        unsigned int i,j,h,counter;

        unsigned int point1y,point2y;                        //波形1连接点
        unsigned int point21y,point22y;                //波形2连接点
        unsigned int point31y,point32y;                //波形3连接点
        point2y = 0; //initial value
        point22y = 0; //initial value
        point32y = 0; //initial value

  #define grid_width 601                        //波形显示区宽
  #define grid_height  401                //波形显示区高
  #define grid_gap 50                                        //刻度间隔
   
        Select_Main_Window_16bpp();
        Main_Image_Start_Address(0);                               
        Main_Image_Width(800);                                                       
        Main_Window_Start_XY(0,0);

        Canvas_Image_Start_address(0);//Layer1
        Canvas_image_width(800);
        Active_Window_XY(0,0);
        Active_Window_WH(800,600);

        BTE_Solid_Fill(0,800,0,0,Blue,LCD_width,LCD_height);
        BTE_Solid_Fill(0,800,0,456,Blue2,LCD_width,24);
       
        Select_Font_Height_WxN_HxN_ChromaKey_Alignment(24,1,1,1,0);
        Print_Internal_Font_String(0,Line18,800,24,color65k_white,Blue2, "                     Application Demo Waveform");
        Print_Internal_Font_String(0,Line19,800,24,color65k_white,Blue2, "          BTE Memory Copy & Geometric Draw Demo Waveform");
        Active_Window_XY(0,0);
        Active_Window_WH(LCD_width,LCD_height);
        Graphic_Mode();
       
        BTE_Solid_Fill(800*480*2,800,0,0,Black,LCD_width,LCD_height);        //Layer2填充黑色
        Canvas_Image_Start_address(800*480*2);        //当前画布切到Layer2

        //在Layer2绘制600*400的刻度盘
        for(i=0;i<=grid_width;i+=grid_gap)
        {
                Draw_Line(color65k_grayscale12,i,0,i,grid_height-1);
        }
        for(i=0;i<=grid_height;i+=grid_gap)
        {
                Draw_Line(color65k_grayscale12,0,i,grid_width-1,i);
        }

        //将Layer2的刻度盘复制到Layer1
        BTE_Memory_Copy(800*480*2,800,0,0,0,0,0,0,0,800,100,20,12,601,401);
        Canvas_Image_Start_address(0);        //当前画布切到Layer1

        h=0;
        do{
                        for(i=0;i<600;i+=2)
                        {
                                //复制Layer2的表盘到Layer1,每次复制区块大小2x401
                                BTE_S0_Window_Start_XY(i,0);
                                BTE_Destination_Window_Start_XY(100+i,20);  
                                BTE_Window_Size(2,401);
                                BTE_Enable();
                                Check_BTE_Busy();

                                point1y = point2y;
                                point2y = rand()%90;
               
                                point21y = point22y;
                                point22y = rand()%99;
       
                                point31y = point32y;
                                point32y = rand()%67;
                 
                                Draw_Line(color65k_yellow,i+100,point1y+80,i+1+100,point2y+80);                                //绘制波形1
                                Draw_Line(color65k_purple,i+100,point21y+200,i+1+100,point22y+200);                //绘制波形2
                                Draw_Line(color65k_green,i+100,point31y+300,i+1+100,point32y+300);                //绘制波形3
            }
          }
                while(h++<30);
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|Lcdvision Technology ( 苏ICP备10203891号 )

GMT+8, 2026-7-6 06:01 , Processed in 0.089108 second(s), 26 queries .

快速回复 返回顶部 返回列表