Timer and counter of single chip microcomputer

Source: Internet
Author: User

Counter

From a routine of life to see: a water basin under the faucet, the water hose is not tightly closed, drip drops into the basin. Water droplets continue to fall, the capacity of the basin is limited, and after a period of time, it will gradually become full. So what is the size of the counter in a single chip microcomputer? 8031 single-chip microcomputer has two counters, called T0 and T1, respectively, the two counters are composed of two 8-bit RAM units, that is, each counter is 16-bit counter, the largest count is 65536.

Timer

The counter can also be used as a clock in addition to being counted, how is the counter used as a timer?

Count and time are really very relevant, an alarm clock will be timed in 1 hours after the alarm, it can be said that the second hand walked (3600) times, the time is converted to the number of seconds to walk.

Timer counter structure

As long as the interval of the counting pulses is equal, the counting value represents the passage of time. Thus, the single-chip microcomputer Timer and counter is a thing, but the counter is recorded in the outside world, and the timer is a single-chip microcomputer supply a very stable count source.

Timer is the count source is a single-chip crystal oscillator after 12 to obtain a pulse source, counting pulse interval and crystal oscillator, a 12M crystal oscillator 12M/12 equals 1MHZ, the countdown is 1 microseconds

Overflow

A counter overflow will cause the TF0 to change to "1", which will cause the event to become 1.

There will often be less than 65,536 of the requirements of the number, we use the method of pre-set, I want to count 100, then I put in 65436, then 100 pulses, to 65536. Timing is the same, each pulse is 1 microseconds, the full 65,536 pulses will take 65.536 milliseconds, if only 10 milliseconds, 10 milliseconds for 10,000 microseconds, so long as the counter inside the 55536 can be.

Timer and counter of single chip microcomputer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.