can i use timer in arduino nano board !!!

hi ! i'd like use the timer in avr and a thing arduino have timer , too . but i can't to know how to use it even thought have looking for the reference lib carefully .
please help me and thank for you very much !!!!

What sort of period are you trying to time ?
What will initiate the timing ?
What will terminate the timing ?

hi ! i'd like use the timer in avr and a thing arduino have timer , too . but i can't to know how to use it even thought have looking for the reference lib carefully .

what are you thinking you need to do most probably with a timer?

The demo several things at a time shows how to use millis() for timing. The same technique will also work with micros()

...R

read blink without delay. that introduces timing.

Are you are trying to use the timer library ?

what do you want to DO with the timer ? the answer may be very simple.

dave-in-nj:
read blink without delay. that introduces timing.

Are you are trying to use the timer library ?

what do you want to DO with the timer ? the answer may be very simple.

oh thank for your point but u understand me , the milis() function will return in mili second it will overflow went beyond 50 days . and i can use it for my machine what i need is the timing in every clock frequency ( like as avr MCU ) and can handle time over flow

If you use the right technique
currentMillis - activityStartMillis >= requiredPeriodTo test whether the period has ended then the overflow to zero after 49 and a bit days will not matter as long as the period is less than 49 days.

chauvoluuhuong:
it will overflow went beyond 50 days .

The code in several things at a time deals with this in the way that @UKHeliBob recommends.

...R

UKHeliBob:
If you use the right technique
currentMillis - activityStartMillis >= requiredPeriodTo test whether the period has ended then the overflow to zero after 49 and a bit days will not matter as long as the period is less than 49 days.

thank ,
when it overflow the milis() function will return 0 ?? and then i have new question that we can read Pins simultaneously like as in AVR mcu if i read PORD B will declare that
variable=PINB

When millis() gets to 4,294,967,295 it rolls over to zero and the count starts again but the subtraction method of determining whether the period has elapsed will be unaffected by the rollover.

Yes, you can read the state of several pins at the same time in the way that you suggest as long as they are on the same port. See port manipulation

Take a look at this sketch. It counts input pulses on pin D5, for one second, and then displays the 'Frequency' of that signal input. Not real sexy, but functional for low frequencies (below ~4MHz):

Note how timer overflow is handled...

FrequencyCounter.pde (2.97 KB)