What is the best solution to design a Timer ?
Posted: Thu Feb 27, 2025 1:41 pm
Hello,
I progress good with PC App, I use function per button to drive my device, exactly like with a programmable remote control software. Work fine but I want also add function with event timer in background of the software. I tried 3 methods and the result is very strange. I use a button to start the timer with debug window to see the values of counters in real time.
The first method use a 500ms delay with a counter. With this counter I designed two timer: per 1 second and per 10 seconds.
Work fine but this timer is stopped when I push on a other button. It's the best method I find, the timer is stopped but the button function work fine and the timer restart after the button code is sent.
The second method use interrupt per 0.5Hz. Interrupt have not priority level parameter and is stopped when I push on a other button and create bug.
The third method use Trigger component with 1 second. When I push button the trigger event macro stop the function of the other buttons and create bug.
When I push button, I also need a long touch function, if it's possible without stop the timer in background.
Have you advice ?
Thank you so much.
I progress good with PC App, I use function per button to drive my device, exactly like with a programmable remote control software. Work fine but I want also add function with event timer in background of the software. I tried 3 methods and the result is very strange. I use a button to start the timer with debug window to see the values of counters in real time.
The first method use a 500ms delay with a counter. With this counter I designed two timer: per 1 second and per 10 seconds.
Work fine but this timer is stopped when I push on a other button. It's the best method I find, the timer is stopped but the button function work fine and the timer restart after the button code is sent.
The second method use interrupt per 0.5Hz. Interrupt have not priority level parameter and is stopped when I push on a other button and create bug.
The third method use Trigger component with 1 second. When I push button the trigger event macro stop the function of the other buttons and create bug.
When I push button, I also need a long touch function, if it's possible without stop the timer in background.
Have you advice ?
Thank you so much.