Timer Circuits important Electronic device at Robotics
Timer Circuits are Known as Counter also.
What is Timer Circuit at electronic?
Timers are used everywhere. Without timers, you would end up
nowhere! The range of timers vary from a few microseconds (like the ticks of a
processor) to many hours (like the lecture classes ), and
AVR is suitable for the whole range! AVR boasts of having a very accurate timer, accurate to the resolution of microseconds! This feature makes them suitable for timer applications.
AVR is suitable for the whole range! AVR boasts of having a very accurate timer, accurate to the resolution of microseconds! This feature makes them suitable for timer applications.
What is Importance of timer circuit at electronic?
timers is an important concept in the field of electronics.
You can generate a time base using a timer circuit, using a microcontroller,
etc. Since all the microcontrollers work at some predefined clock frequency,
they all have a provision to set up timers.
You come across timers everyday. Simplest example hangs on
your wall or maybe tied around your wrist. You can say that they have a unique
property to measure time. Everything in this world is synchronized with time.
You wake up at, say, 6 o’clock; you work everyday for 8 hours; you need to
drink water every 4 hours, etc. But the concept of timers isn’t confined to
your daily routines. Every electronic component works on a time base. This time
base helps to keep all the work synchronized. Without a time base, you would
have no idea as to when to do a particular thing.
Timers as registers
So basically, a timer is a register! But not a normal one.
The value of this register increases/decreases automatically. In AVR, timers
are of two types: 8-bit and 16-bit timers. In an 8-bit timer, the register used
is 8-bit wide whereas in 16-bit timer, the register width is of 16 bits. This
means that the 8-bit timer is capable of counting 2^8=256 steps from 0 to 255
as demonstrated below.
8 bit Counter
Similarly a 16 bit timer is capable of counting 2^16=65536
steps from 0 to 65535. Due to this feature, timers are also known as counters.
Now what happens once they reach their MAX? Does the program stop executing?
Well, the answer is quite simple. It returns to its initial value of zero. We
say that the timer/counter overflows.
Let us learn Timer Concepts Mathematical J
Now suppose, we need to flash an LED every 10 ms. This
implies that its frequency is 1/10ms = 100 Hz. Now let’s assume that we have an
external crystal XTAL of 4 MHz. Hence, the CPU clock frequency is 4 MHz. Now,
as I said that the timer counts from 0 to TOP. For an 8-bit timer, it counts
from 0 to 255 whereas for a 16-bit timer it counts from 0 to 65535. After that,
they overflow. This value changes at
every clock pulse.
Difficulties with timer Circuits:-
this is not exclusively related to timers, but I thought of
discussing it as it is used in a variety of places. Let me explain it using an
analogy. Say now you are reading my post. It’s dinner time and your mom (only
if you live with your mom ) calls you for dinner. What do you do (if she gets
too creepy)? You save your work and attend to your mom’s call, then return and
resume reading. This is an example of interrupt.
In most microcontrollers, there is something called
interrupt. This interrupt can be fired whenever certain conditions are met. Now
whenever an interrupt is fired, the AVR stops and saves its execution of the main
routine, attends to the interrupt call
(by executing a special routine, called the Interrupt Service Routine, ISR) and
once it is done with it, returns to the main routine and continues executing
it.
For example, in the condition of counter overflow, we can
set up a bit to fire an interrupt whenever an overflow occurs. Now, during
execution of the program, whenever an overflow occurs, an interrupt is fired
and the CPU attends to the corresponding ISR. Now it’s up to us what do we want
to do inside the ISR. We can toggle the value of a pin, or increment a counter,
etc etc.
If you didn’t get the concept of interrupts and ISR, behold
for sometime till we discuss it how to implement it in hardware.
Help:- www.maxembedded.com
No comments:
Post a Comment