Analysis of the Causes of Single Chip Microcomputer Clock Error

Publisher:科技思想家Latest update time:2015-03-24 Source: diangonKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. The timing pulse reference of the single-chip microcomputer electronic clock is provided by the frequency of the external crystal oscillator after 12 divisions, and the internal timing and counter are used to realize the timing function. Therefore, the accuracy of the external crystal oscillator frequency directly affects the accuracy of the electronic clock timing.

2. The electronic clock of the single-chip microcomputer uses internal timing, counter overflow to generate an interrupt (12MHz crystal oscillator is generally 50ms) and then multiply it by the corresponding multiple to realize the conversion of seconds, minutes and hours. As we all know, it takes 3-8 machine cycles from the timing and counter generating an interrupt request to responding to the interrupt. The data stack in the timing interrupt subroutine and the initial value of the timing and counter also take several machine cycles. In addition, it also takes a certain machine cycle to switch from the interrupt population to the interrupt subroutine. For example:

1.jpg

From the above program, it can be seen that it takes 2+2+2=6 machine cycles to load the lower 8 bits from the interrupt population to the initial value of the timer/counter. Therefore, these 6 machine cycles are generally added to the initial value of the timer/counter during programming. However, it takes several machine cycles (3~8 machine cycles) from the timer/counter overflow interrupt request to the execution of the interrupt. It is difficult to determine the exact value, which is the reason why the electronic clock timing is inaccurate.

Keywords:MCU Reference address:Analysis of the Causes of Single Chip Microcomputer Clock Error

Previous article:Solution to MCU clock error
Next article:Two common negative voltage generating circuits in single chip microcomputer electronic circuits

Recommended ReadingLatest update time:2024-11-16 14:52

51 single chip microcomputer and TA8435 stepper motor subdivision control
1 Stepper motor Stepper motor is a pure digital control motor. It converts electrical pulse signal into angular displacement. That is, when a pulse is given, the stepper motor rotates an angle. Therefore, it is very suitable for single-chip microcomputer control. Under non-overload conditions, the motor speed an
[Microcontroller]
51 single chip microcomputer and TA8435 stepper motor subdivision control
[51 MCU STC89C52] Use of LCD1602 LCD screen
1. LCD1602 module 1. Pin description Pin 3: VL is the contrast adjustment terminal of the LCD. The contrast is the weakest when connected to the positive power supply, and the contrast is the highest when connected to the ground. If it is too high, "ghosting" will occur. The contrast can be adjusted through a 10K p
[Microcontroller]
[51 MCU STC89C52] Use of LCD1602 LCD screen
51 MCU serial port operation entry experience summary and C source code
It feels good to use a computer to control a microcontroller, and then control other peripherals such as relays. How to achieve it? Let's do it step by step. To realize the microcontroller serial port communication, that is, the communication between the microcontroller and the computer, you need to understand some ba
[Microcontroller]
Liujing MCU Bidirectional Thyristor Interface MDK160
The most convenient way to control industrial frequency AC power with a single chip microcomputer is to use a bidirectional thyristor MDK160A. In order to avoid the interference and influence on the power supply caused by the impact current generated when the thyristor is turned on, MDK160A can use zero-crossing trigg
[Microcontroller]
Liujing MCU Bidirectional Thyristor Interface MDK160
PIC microcontroller internal power-off lock reset
  1. Design ideas   In the single-chip microcomputer application system, if dry batteries or rechargeable batteries are used for power supply, there is a problem of continuous battery voltage drop. If AC power is used for power supply, there are problems of voltage fluctuation and power supply interference.   The in
[Microcontroller]
PIC microcontroller internal power-off lock reset
51 MCU driving capability (source current_sink current) and pull-up resistor
It seems that many netizens are confused about the concepts of sink current and source current. Let me explain this below. I hope that you will not be troubled by this after reading this article. An important premise: sink current and source current are for ports. Glossary - Sink: inject, fill, from outs
[Microcontroller]
The growth path of single-chip microcomputer (avr basics) - 003 BOOT area of ​​AVR single-chip microcomputer
The origin of the BOOT area is based on a simple principle, that is, the program of the microcontroller is stored in the FLASH, and to run the program, the FLASH memory must be accessed continuously. For general FLASH memory, it takes a certain amount of time to write data. Before the data is written, all the data in
[Microcontroller]
Implementing Complex Discrete Logic Using Microcontrollers
Developers can use the Configurable Logic Block (CLB) peripheral in the PIC16F13145 family of microcontrollers to implement complex discrete logic functions in hardware, thereby reducing the bill of materials (BOM) and developing custom application-specific logic. In many embedded system application
[Microcontroller]
Implementing Complex Discrete Logic Using Microcontrollers
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号