The difference between 51 MCU counter and timer

In the learning process of 51 single-chip microcomputer, we often find that the interrupt, counter/timer and serial port are the difficulties in learning the single-chip microcomputer. For beginners, the contents of these parts are difficult to understand. But I personally think that these parts are the focus of MCU learning. If you don't understand these parts in a semester class or self-study, it means that you haven't mastered 51 MCUs yet, let alone the development of MCU. We all know that in the finished MCU project, there are many based on these parts. The perpetual calendar is based on timers. The alarm is mainly based on interrupts. The online communication is mainly based on serial port.

In these parts, counters/timers are easy to confuse for beginners. I will talk about this in combination with my own learning experience.

The essence of the counter and the timer are the same. They all count the pulses generated in the MCU, except that the counter is the externally triggered pulse of the MCU. The timer is the pulse generated by the internal oscillator under the trigger of the crystal oscillator. Counters and timers are a concept when their pulse intervals are the same.

There is an overflow concept in both the timer and the counter, so what is overflowing. Oh, we can get the answer from a little common sense of life. When a bowl is placed under the tap to pick up the water, after a while, the bowl of water is full, and it overflows. By the same token, assuming that the water in the faucet is dripping into the bowl, there is always a drop of water that causes the water in the bowl to overflow. The water overflowing in the bowl is wasted, but overflowing in the timer counter of the microcontroller will cause an interrupt. As for what is interrupted, we will talk about it next time. Here is only a preliminary concept. The interrupt can interrupt the normal operation of the system. The process of running the interrupt service routine, when the service program runs, automatically returns to the interrupted place to continue running.

In the timer counter, we have a concept called capacity, which is the maximum count. Mode 0 is the 13th power of 2, Mode 1 is the 13th power of 2, Mode 2 is the 8th power of 2, and Mode 3 is the 8th power of 2. The water droplet is likened to a pulse, and the last drop of water that causes the water in the bowl to overflow is the last pulse of the overflow of the timer counter.

In the various MCU books, when the timing counter is introduced, an initial value is counted. What is the initial value of the count? Here we still assume a drop bowl. Assuming that the first hundred drops of water can overflow the water in the bowl, we know that the bowl has a capacity of 100. Question 1, how can I make the bowl overflow with 10 drops of water? Oh, I can imagine that if you take an empty bowl to pick up the water, you still have to drop 100 drops of water to overflow, but if we take a bowl that already has water, then we don't need 100 drops. At this point we can figure out that if 10 drops of water are allowed to overflow the water in the bowl, then 90 drops of water must be placed in the bowl.

In the timing counter, these 90 drops are what we call the initial value. Question 2: In a workshop, how do we use the MCU to calculate the pieces of 100 products and carry out automatic packaging?

We can use the counter to count 100 and perform an automatic wrapper in the interrupt.

There are three initial counts here, assuming that there is a mode 0: the initial value of the count = 8912 (2 to the power of 13) - 100 = 8812. Method 1: Count initial value = 65536 (2 to the 16th power) - 100 = 65436. Mode 0: Count initial value = 256 (2 to the 8th power) - 100 = 156.

According to the initial value obtained, and then convert it to hexadecimal or binary, you can count or time. Of course, to make the program run completely, you need to set the corresponding registers. These can be found in a variety of microcontroller tutorials.

Door Bell Transformer

Doorbell transformers are typically installed at the point where the doorbell system connects to the main electrical supply. They are compact, lightweight, and designed for easy installation and maintenance. These transformers are widely used in residential, commercial, and industrial settings, where doorbells are an essential part of security and communication systems.
Key Functions
Voltage Conversion:
The primary function of a doorbell transformer is to step down the voltage from the standard household AC supply (e.g., 110V or 220V) to a lower DC or AC voltage required by the doorbell system. Common output voltages include 12V DC, 16V DC, or 10V AC.
Safety:
By converting high voltage to low voltage, doorbell transformers provide a layer of safety, reducing the risk of electrical shock or fire hazards associated with high-voltage circuits.
Compatibility:
Doorbell transformers are available in various specifications to accommodate different types of doorbell systems, including wired, wireless, and smart doorbells. This ensures compatibility with a wide range of doorbells and installation environments.
Technical Specifications
Input Voltage: The voltage range at which the transformer can accept power from the main supply.
Output Voltage: The voltage level at which the transformer supplies power to the doorbell system.
Output Current: The maximum current the transformer can deliver at the specified output voltage.
Power Rating: The total power the transformer can handle without overheating or damaging the circuit.
Size and Weight: Physical dimensions and weight, which can affect installation requirements and space constraints.
Connector Type: The type of output connector used to connect the transformer to the doorbell system (e.g., screw terminals, push-in connectors).
Installation and Maintenance
Installation: Doorbell transformers are typically installed near the electrical panel or in a convenient location close to the doorbell system. They require basic electrical wiring knowledge and follow standard electrical codes and regulations.
Maintenance: Regular maintenance involves checking the voltage output and wiring connections to ensure the transformer is functioning properly. Replacement may be necessary if the transformer fails or the doorbell system requires an upgrade.
Smart Home Integration
With the rise of smart homes, some modern doorbell systems are designed to integrate with other smart devices and home automation systems. While these systems may not require a traditional doorbell transformer due to built-in power management modules, they still rely on power conversion principles similar to those employed by traditional doorbell transformers.
Conclusion
In summary, doorbell transformers are essential components of doorbell systems, providing safe and reliable power conversion from standard household AC supplies to the lower voltages required by doorbells. Their technical specifications, ease of installation and maintenance, and compatibility with various doorbell types make them indispensable in residential, commercial, and industrial settings. As smart home technology continues to evolve, doorbell transformers may evolve alongside these systems, adapting to new power management requirements and integration capabilities.

Doorbell Transformer,nest doorbell transformer,24v doorbell transformer,buck boost transformer

Guang Er Zhong(Zhaoqing)Electronics Co., Ltd , https://www.gezadapter.com