Start a new topic
Not Taken

timer from page1 stops working when im back on page0


I would like to set a clock and turn it on page 1 as well as I would like this timer from page 1 to be working when Im back on the page 0. Unfortunately when Im on page 0 the work on page 1 stops :( I even set everything as a global and still doesnt work as I would like to.

When you debug click right blue button on the right to go page1. On the page 1 click dual state button to start working.

Please help


1 person likes this idea

I tested your hmi, created another.  It seems timers are page dependent.  The display is not going to be able to keep accurate time as a clock while users are switching pages without an RTC (Enhanced version) If your display going to be connected to an Arduino or other that has an RTC, perhaps syncing time using a command n1.val=<updatedtime> maybe an option.  To get the counter to continue I placed a single global var va0 on page0, and on each page 0 and page 1 have their own timer that will increment page0.va0 and display to their pages number component.

This will lose whatever time is remaining is left before the next timer event is called when page switching.  I have attempted to decrease this effect by using a faster timer and divide to lose the fraction of a second before displaying.  Time in 1/10th seconds is stored in va0.  Calculating your displayed time should be done through variables and only your final result to be written to your clock.txt as drawing the values to your screen is stealing precious time.  Also make an attempt to only calc and display the time if you are on the top of the 10th of a second, may save you some clock cycles.

Hope this helps you gets you farther along your way.

(10.3 KB)

if you can declare a timer as global you should expect it to be run in the background


Design it yourself then, then you will have a timer that runs in the background as you would expect.

But in a single core single threaded MCU in sequential programming, my expectations aren't as high.  If you use the Enhanced Version, then it includes the RTC, and that of course changes the game.

i have the advanced.


Changing pages:

- Clears previous page.

- Initiates Pre-Initialization event

- Sets new page to default values defined in your HMI

- Initiates the Post-Initialization event

- carries on waiting for new events to occur.

When changing pages, you should find a means of transferring your timer values forward to your new page.  Sys0,sys1,sys2 are built in numeric variables great for using as parameter passing.

Perhaps in your page exiting button (that causes the page to change) copy current time to a variable, or in the Pre-Initialization Event.  After the page defaults are set, inside the Post-initialization event retrieve the value from the variable you stored it in during the page change, and set things up to carry on.

Example already provided in the HMI, or have your host MCU look after the timers

I am now reviewing all of the Feature Requests, this will take some time, patience please.

Although this wasn't a real feature request, it is now marked as reviewed.

Future questions should be posted to the Free Chat Section


The relevance of the information I posted a year ago is still relevant today.

Please use the information I provided, examine the clock.HMI file I made.

    absorb the knowledge here - and respect

"Future questions should be posted to the Free Chat Section"

Login or Signup to post a comment