Oscilloscope Design—Waveform Fast Refresh Solution

Publisher:andyliow1980Latest update time:2021-07-02 Source: eefocusKeywords:Oscilloscope Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere


This problem is not easy to see if you don't pay close attention. At first I thought it was a software configuration problem, and I debugged it but it didn't work. Later I set different duty cycles of the backlight PWM, but it didn't work either.


Later, I simply turned off PWM, and also turned off the layers of emWin and LCD, only displayed the background layer, and directly operated the high and low levels of the PWM pin. The test found that after configuring it to a low level, there was no problem if the LCD was lit after a delay of about 200ms. If the delay time was shorter, there would be a momentary highlight. Knowing this reason, it was easy to solve it in the program. You can directly delay 200ms before lighting it up. This second-generation oscilloscope does not need to do this, because after power-on, the background of various measurement windows and the background of the waveform display area need to be drawn into the storage device, which is just used to replace the 200ms delay.


GUI_Init();


/* Turn off the backlight first*/


LCD_SetBackLight(0);


 


/* Load various window backgrounds here */


/* Show all windows */


GUI_Exec();


    


/* Turn backlight on again*/


LCD_SetBackLight(255);


/* Start other operations */


In this way, the problem of instant highlighting is perfectly solved.


5.4 Refreshing the Measurement Window

The measurement function refers to the following horizontal and vertical measurements:


The data display of the measurement function should not be presented in the form of a window, because displaying the window on the waveform display area will cause the waveform to refresh slowly. The current solution is to directly draw the measurement window with a 2D function after drawing the waveform. This method has a much better actual effect.


5.5 How to refresh the interface when opening or closing dialog boxes

There are the following five buttons on the main interface of the second-generation oscilloscope. A dialog box will pop up when clicked.

 

What we want to discuss here is the problem when closing this dialog box. When closing this dialog box, in order to ensure the overall refresh effect of the main interface, it is necessary to clear the background and refresh the background of the oscilloscope waveform display area at the same time (file DSO_Init.c):


GUI_SetBkColor(0x905040);


GUI_Clear();


GUI_MEMDEV_WriteAt(hMemDSO, 40, 40);

In this way, the effect of closing the dialog box drawing is much better.


5.6 Fast refresh of five numerical display windows

The five numerical display windows refer to the following five:

 

There are mainly amplitude windows, two status windows, frequency window and system information window. These windows are created in the form of dialog boxes for easy management. The WM_PAINT message of the dialog callback function uses a large number of 2D functions to draw. Each refresh of the value still affects the system performance. In order to reduce the impact, it is necessary to draw it into the storage device in advance, which is similar to the method in Section 5.2 of this chapter. Here we take one of the status windows as an example to illustrate. The following graphics and characters should be drawn in the WM_PAINT message:


/*


*********************************************************************************************************


* Function name: PaintDialogStatus1


* Function description: The callback function of the status window redraws the message


* Parameter: pMsg pointer address            


* Return value: None


*********************************************************************************************************


*/


void PaintDialogStatus1(WM_MESSAGE * pMsg)


{


     /* Clear background color */


     GUI_SetBkColor(0x905040);


     GUI_Clear();


    


     /* Draw a filled anti-aliased rounded rectangle*/


     GUI_SetColor(GUI_BLACK);


     GUI_AA_FillRoundedRect(0, 0, 509, 34, 10);


    


     /* Draw an anti-aliased rounded rectangle*/


     GUI_SetColor(0XEBCD9E);


     GUI_SetPenSize(2);


     GUI_AA_DrawRoundedRect(0, 0, 509, 34, 10);


    


     /* Draw an anti-aliased rounded rectangle and fill it with a value of 1 */


     GUI_SetColor(GUI_YELLOW);


     GUI_AA_FillRoundedRect(10, 4, 30, 16, 3);


    


     GUI_SetColor(GUI_BLACK);


    GUI_SetFont(&GUI_Font16_1);


     GUI_SetTextMode(GUI_TEXTMODE_TRANS);                   


     GUI_DispCharAt('1', 16, 3);


 


     /* Draw an anti-aliased rounded rectangle and fill it with a value of 1 */


     GUI_SetColor(GUI_YELLOW);


     GUI_AA_FillRoundedRect(135, 4, 155, 16, 3);


                              


     GUI_SetColor(GUI_BLACK);


    GUI_SetFont(&GUI_Font16_1);


     GUI_SetTextMode(GUI_TEXTMODE_TRANS);                   


     GUI_DispCharAt('1', 141, 3);


    


     /* Draw an anti-aliased rounded rectangle and fill it with a value of 1 */


     GUI_SetColor(GUI_YELLOW);


     GUI_AA_FillRoundedRect(260, 4, 280, 16, 3);


                              


     GUI_SetColor(GUI_BLACK);


    GUI_SetFont(&GUI_Font16_1);


     GUI_SetTextMode(GUI_TEXTMODE_TRANS);                   


     GUI_DispCharAt('1', 266, 2);


    


     /* Draw an anti-aliased rounded rectangle and fill it with a value of 1 */ 


     GUI_SetColor(GUI_YELLOW);


     GUI_AA_FillRoundedRect(385, 4, 405, 16, 3);


                              


     GUI_SetColor(GUI_BLACK);


    GUI_SetFont(&GUI_Font16_1);


     GUI_SetTextMode(GUI_TEXTMODE_TRANS);                   


     GUI_DispCharAt('1', 391, 2);


    


     /* Draw an anti-aliased rounded rectangle and fill it with a value of 2 */


     GUI_SetColor(GUI_GREEN);


     GUI_AA_FillRoundedRect(10, 19, 30, 31, 3);


                              


     GUI_SetColor(GUI_BLACK);


    GUI_SetFont(&GUI_Font16_1);


     GUI_SetTextMode(GUI_TEXTMODE_TRANS);                   


     GUI_DispCharAt('2', 16, 18);


    


     /* Draw an anti-aliased rounded rectangle and fill it with a value of 2 */


     GUI_SetColor(GUI_GREEN);


     GUI_AA_FillRoundedRect(135, 19, 155, 31, 3);


                              


     GUI_SetColor(GUI_BLACK);


    GUI_SetFont(&GUI_Font16_1);


     GUI_SetTextMode(GUI_TEXTMODE_TRANS);                   


     GUI_DispCharAt('2', 141, 18);


    


     /* Draw an anti-aliased rounded rectangle and fill it with a value of 2 */


     GUI_SetColor(GUI_GREEN);


     GUI_AA_FillRoundedRect(260, 19, 280, 31, 3);


                              


     GUI_SetColor(GUI_BLACK);


    GUI_SetFont(&GUI_Font16_1);


     GUI_SetTextMode(GUI_TEXTMODE_TRANS);                   


     GUI_DispCharAt('2', 266, 18);


 


     /* Draw an anti-aliased rounded rectangle and fill it with a value of 2 */


     GUI_SetColor(GUI_GREEN);


     GUI_AA_FillRoundedRect(385, 19, 405, 31, 3);


                              


     GUI_SetColor(GUI_BLACK);


    GUI_SetFont(&GUI_Font16_1);


     GUI_SetTextMode(GUI_TEXTMODE_TRANS);                   


     GUI_DispCharAt('2', 391, 18);


}


Draw it into the storage device in the following way (load it when the system is powered on):


/*


*********************************************************************************************************


* Function name: DrawWinStatus1Bk


* Function description: Draw the window background into the storage device


* Parameters: None          


* Return value: None


*********************************************************************************************************


*/


void DrawWinStatus1Bk(void)


{


     hMemStatus1Dlg = GUI_MEMDEV_CreateFixed(0,


                                                   0,


                                                  510,


                                                  35,


                                                  GUI_MEMDEV_HASTRANS,


                                                   GUI_MEMDEV_APILIST_16,


                                                   GUICC_M565);


     GUI_MEMDEV_Select(hMemStatus1Dlg);


     PaintDialogStatus1(NULL);


     GUI_MEMDEV_Select(0);


}


Then fill the following function into the status window callback function WM_PAINT message


GUI_MEMDEV_WriteAt(hMemStatus1Dlg, 145, 444);

The design method of the other four windows is similar. Through such optimization, the burden of GUI refresh is reduced to a certain extent.


 


5.7 Summary

It is recommended that you actually test different solutions, so that you will have a profound experience.


[1] [2]
Keywords:Oscilloscope Reference address:Oscilloscope Design—Waveform Fast Refresh Solution

Previous article:Oscilloscope selection parameters
Next article:How to use the oscilloscope trigger

Latest Test Measurement Articles
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号