Based on the introduction of S3C2410, this paper analyzes the internal structure and working mechanism of RTC, and finally gives the application development dedicated to RTC function.
Hardware Structure
S3C2410 Processor Introduction
S3C2410 is a 16/32-bit RISC microprocessor launched by Samsung. It is a microcontroller solution for small handheld devices and embedded system applications with high cost performance, low power consumption and high performance. S3C2410 uses the ARM920T core.
Figure 1 S3C2410 internal RTC module structure
Hardware Architecture
The RTC module can continue to work when the system is powered off by the backup battery. It can convert 8-bit data into BCD format and transmit it to the CPU. These data include seconds, minutes, hours, date, week, month, and year. The RTC module needs an external crystal oscillator to provide a frequency of 32.768kHz to work, and it can also complete the alarm function.
The internal RTC module structure block diagram of S3C2410 is shown in Figure 1. XTlrtc and Xtortc are two pins connected to the external crystal oscillator. They are connected to the 32.768kHz crystal oscillator to provide frequency input for the RTC. The 215 clock divider is responsible for dividing the signal input from the external crystal oscillator with a division accuracy of 215. The clock tick generator can generate clock ticks, which can cause interrupts. It is set by a register called TICNT. There is an interrupt enable bit and a count value n (n can be 1~127) in the register. The period of the clock tick is calculated according to the following formula:
Period = (n+1)/128 seconds (1)
The leap year generator determines whether the last day of a month is 28, 29, 30 or 31 according to the BCD data obtained from the date, month and year (that is, calculates whether it is a leap year). The alarm generator can decide whether to alarm according to the specific time. The control register controls the read/write BCD register enable, clock reset, clock selection, etc. The reset register can select the boundary of the "second" to "minute" carry, providing three optional boundaries: 30, 40 or 50 seconds.
The most important function of the RTC is to display the time. In power-off mode, the RTC can still work normally. At this time, the RTC module works through an external battery. The battery is generally a silver core battery that can provide a voltage of 1.8V, and the battery is connected to the pin RTCVDD dedicated to the RTC power supply. The RTC time display function is realized by reading/writing registers. To display seconds, minutes, hours, date, month, and year, the CPU must read the values stored in the BCDSEC, BCDMIN, BCDHOUR, BCDDAY, BCDDATE, BCDMON, and BCDYEAR registers. The time setting is also realized by the above registers, that is, the above registers are readable and writable.
Figure 2 RTC application development flow chart
Programming
This design is based on the S3C2410 embedded development platform, and combines the PC's hyperterminal to complete the RTC module initialization, time display (displayed in the hyperterminal), time setting, reset test, alarm test, clock tick test and other functions. Its program development process is shown in Figure 2. In order to complete the above functions, some initialization work is required in the early stage.
Hardware initialization
The RTC module is not isolated. It is an internal module of S3C2410. To program it, the initialization of the embedded system based on S3C2410 must be completed. The initialization work includes the initialization of S3C2410 and the serial port and the implementation of some auxiliary functions.
The initialization work of S3C2410 includes the definition of program entry point, the determination of interrupt vector, the initialization of stack, power management (including power-off and restart processing), the definition of register addresses of each module of S3C2410 and its initialization. The above initialization work is closely related to the hardware and is programmed using the 32-bit ARM/Thumb instruction set.
This design uses the PC's hyperterminal as the human-machine interface to complete the debugging, time display and command selection of the RTC module. Therefore, before designing the RTC module function, the serial port should be initialized. The serial port initialization is completed by setting PCLK (CPU system clock), baud rate setting, control register setting, etc. This part of the program is not particularly closely related to the hardware and can be completed in embedded C language. When performing human-computer interface interaction, some information needs to be input/output from the hyperterminal.
Functional design
After completing the initialization work, the functional application of the RTC module is developed. According to the top-down program design idea, the functional application can be divided into different functional modules for implementation. These functional modules are implemented by specific functions. When writing the main() function, different sub-functions can be called according to the different functions to be completed. The following introduces the implementation of sub-functions of each functional module.
The RTC module initialization is implemented by the function Rtc_Init(). The function mainly implements the initialization of BCD data. When other functions read the initialization time, this function can be called.
The time setting function is implemented by the function Rtc_TimeSet(). This function calls the Uart_GetIntNum() function to read the integer number from the hyperterminal, and the user completes the modification of the current time.
The reset test function is implemented by the function RndRst_Rtc(). This function completes the user's current time setting by calling Rtc_TimeSet(), and then changes the reset boundary by modifying the RTCRST register, and then outputs the time display by calling the Uart_Printf() function. The user can observe the time after the reset to test the reset function.
The alarm test function is implemented by the function Test_Rtc_Alarm(). This function completes the RTC initialization, clears the interrupt mask bit of the RTC module, generates an alarm, and then sets the interrupt mask bit to turn off the interrupt. The clock tick test function is implemented by the
function Test_Rtc_Tick(). The clock tick period is set by the register RTICNT, and the specific value of the clock tick is output by calling Uart_Printf().
The disconnection in the alarm and the disconnection in the clock tick complete the corresponding interrupt status bit and interrupt pending bit to open the interrupt function. The corresponding function can be viewed in the interrupt module of S3C2410.
The display time function is completed by the function Display_Rtc().
Conclusion
This article gives the basic functional design of the RTC module, which can be further developed such as the clock interface to improve its functions and meet the requirements of various embedded system applications.
Previous article:Design of software and hardware platform for ARM9 single chip microcomputer LPC3180
Next article:Application of ADμC7024 in medical electronics
Recommended ReadingLatest update time:2024-11-16 19:37
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Qorvo Online Design Conference-The new Wi-Fi 6 standard is changing the connectivity environment
- BLDC back EMF is a bit weird
- EEWORLD University Hall----Boost and Buck-Boost DCDC Converters Help Wireless Charging Design
- How do I set the impedance of the differential line in ALTIUM19?
- EEWORLD University Hall----Live Replay: Introduction to Keysight's New Optical Communication Test Solution
- A complete list of filter circuits, save it for future use!
- How to choose FPGA development board
- Let’s discuss: When you make PPT, do you make the template yourself or download it from the Internet?
- TI points exchanged for E coins, but not received
- EEWORLD University Hall ---- Data Structure and Algorithm Peking University Zhang Ming