This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can i generated 130 ms precise delay using Timer1 and how to calculate 130ms delay using formula with also explain briefly ?

I am new in nrf51822 controller so help me for coding of my question. any help will be appriciate. thank you.

Parents
  • how about actually asking a proper question. You have a poorly-worded title and one paragraph asking for help. That's useless. Explain properly what you are trying to achieve, explain what you have tried and then you may get some help.

  • You mostly don't have to worry about it - there are macros which turn ms into tick counts for you. The basic idea is the clock can be set to tick at different rates depending on the divider you use. So for instance if you're using the 32kHz clock, and you're running it undivided, 1ms is about 32 ticks. If you're running it with a division of 2, 1ms is 16 ticks.

    If you look at pretty much any of the example code you'll see the use of the macros for setting the tick count, just put 130 into one and you'll get what you need.

Reply
  • You mostly don't have to worry about it - there are macros which turn ms into tick counts for you. The basic idea is the clock can be set to tick at different rates depending on the divider you use. So for instance if you're using the 32kHz clock, and you're running it undivided, 1ms is about 32 ticks. If you're running it with a division of 2, 1ms is 16 ticks.

    If you look at pretty much any of the example code you'll see the use of the macros for setting the tick count, just put 130 into one and you'll get what you need.

Children
No Data
Related