# Question about the dual timer 0 hard code?

I have reference the web and the reference manual, found no clues, can anybody give me some advice or light on me.

The value into the load register depend of your application Here, why 4FFFF … i don’t know, maybe it’s because your application need this specific time … or maybe because you have copy/paste from an example.

So, maybe the real question is : how to compute a “load” value ?
Each timer channel count down from a specified value (the load register) to 0. Higher is the value written into load register, longer is the time need to reach 0. So the value you put here, define the time from start to end (if one-shot) or the period (free-running).

In you code, you have set the timer as free running ; and you have set an interrupt handler. So you will get an interrupt each 4FFFF clock ticks.

The address of timer 1 is 0x40002000 (datasheet page 16 “memory map”) [1]

But, maybe you talk about the channel 1 of timer 0, in this case the address is 0x40001020 to 0x40001038 (see reference manual page 387) [2]

The value into the load register depend of your application Here, why 4FFFF … i don’t know, maybe it’s because your application need this specific time … or maybe because you have copy/paste from an example.

So, maybe the real question is : how to compute a “load” value ?
Each timer channel count down from a specified value (the load register) to 0. Higher is the value written into load register, longer is the time need to reach 0. So the value you put here, define the time from start to end (if one-shot) or the period (free-running).

In you code, you have set the timer as free running ; and you have set an interrupt handler. So you will get an interrupt each 4FFFF clock ticks.

The address of timer 1 is 0x40002000 (datasheet page 16 “memory map”) [1]

But, maybe you talk about the channel 1 of timer 0, in this case the address is 0x40001020 to 0x40001038 (see reference manual page 387) [2]

Thanks Hooligan0, I think there should be a method to compute timer value, for example, if I want to get a 1ms delay, what is the formula or the compute process, I will check other textbooks.Thanks!

Hello Yake and Hooligan0

Thank you for your interests with W7500!

I am so afraid to tell you this one…If you try to find it hard…

In the Dualtimer code, we do not define any value with Timerload.

Even 0x4FFF has no meaning… only meaning is it is someone’s init value.

So, any one can change the value as down counter to do what user wants.

Thank you again and please feel free to ask any questions or any wonders!

lawrence