EmWin 2-Day Express Instance tutorial 004_ software timer (timer) and bit picture animation

Source: Internet
Author: User
Tags bmp image

Note: (1) Open the "Exe\guisimulationdebug.exe" under the project catalog to see the effect. (2) After reading the tutorial 000~005 will basically use Emwin to do the project, other chapters can be consulted when necessary.
Emwin Timer is a software timer, it takes the value of the Os_timems variable as a timing benchmark, and os_timems through a hardware timer per 1ms interrupt plus 1, in the Emwin internal program constantly query Os_timems changes to achieve software timing.
In many applications, we need to use the timer, such as every time to inquire about an event has not been triggered, every time to change the number display to achieve dynamic counting, every time to display a picture to achieve picture animation and so on ....
The use of the timer is relatively simple (please read the example routines code), but there are a few places to note: (1) using a timer to achieve timing accuracy is relatively poor (but the value of Os_timems is accurate), if the need for precise timing, use the hardware timer to create an interrupt implementation. (2) with a timer to refresh the digital or picture display, time interval should not be too short, such as the need to achieve a millisecond counter display, you certainly can not refresh the number every 1ms, it is appropriate to refresh the digital display every 30ms (that is, the counter changes every 30ms). (3) The timer does not stop counting because it hides its parent form (of course, please read the example routines code).
Use the BmpCvt.exe tool (in the tool directory) to convert the animated BMP image to a C file, then add the C file to the Emwin project and use Image_setbitmap () every 100ms (Wm_timer message is valid) The function sets the different pictures to the image control (the Emwin internally handles the update itself, without our worries):



In the routine, it is to provide a emwin implementation of the Image animation template, the user needs to do animation only need to be implemented on the basis of this routine. There is also because the Emwin simulator is Tan Xianqun display, so the screen will inevitably have a "tearing" phenomenon, in the dual memory of the GLCD will not have this phenomenon:



source/software Download


EmWin 2-Day Express Instance tutorial 004_ software timer (timer) and bit picture animation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.