Timer Tick

pdabasic

Active Member
Licensed User
I wrote i little code for testing timer tick event.

I added two timer.
First interval=1
Second interval=1000

First timer increases a variable,
second writes the variable curent value to a label.

If my calculet is ok, every second the label text must to increase with 1000
but it doesn't look like this.... Why?
 

Attachments

  • timer.sbp
    635 bytes · Views: 199

taximania

Well-Known Member
Licensed User
Longtime User
I think it's virtually impossible to update the label at 1/1000th a sec.
The code below isn't far out, using a timer tick of 100

Test done on my laptop, 1.73Ghz processor.

B4X:
Sub Globals
   txt=0
   'Declare the global variables here.
End Sub

Sub App_Start
   Form1.Show
   Timer1.Enabled=True
End Sub

Sub Timer1_Tick
   txt=txt+100
   lbl0.text=txt
End Sub
 

taximania

Well-Known Member
Licensed User
Longtime User
Try this for test results.

Run the .exe on your desktop/laptop.
Enter a T1 of 1. Hit go. there's a 3 sec delay, then T2 starts set at 1000 and T1 starts.
My result is 64. That's 64 out of a 1000 ticks.

Try different T1 values.
 

Attachments

  • testTimer.zip
    14.9 KB · Views: 219
Last edited:

taximania

Well-Known Member
Licensed User
Longtime User
Just run a compile for device. Copied and run the program on my XDA.

Guess what :sign0060:

430 with a setting of T1. Just shows the speed of BasicBppc compiled on the device, even on my old phone.

Gobsmacked is not the word.

Comment's please :sign0142:
 

pdabasic

Active Member
Licensed User
I think it's virtually impossible to update the label at 1/1000th a sec.
The code below isn't far out, using a timer tick of 100

Test done on my laptop, 1.73Ghz processor.

Thats why I change the label text only once/sec.

For me it's mean the timer can change 60-100 times/sec a varriable value!?

It's right?
 
Top