Application design of RTC module based on ARM microcontroller S3C2410

Publisher:PeacefulOasisLatest update time:2011-11-25 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Introduction
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.

Reference address:Application design of RTC module based on ARM microcontroller S3C2410

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

MCU_S3C2410 UART Analysis
Functional Analysis Register Analysis 代碼分析 ////////////////////////////////////////////////////////////////////////////////////UART Initialization/////////////////////////////////////////////////////////////////////////////////////////////////////// void Uart_Init(int pclk,int baud) {  int i;  if(pclk == 0)
[Microcontroller]
ARM S3C2410 Hardware Manual Key Points
Introduction: S3C2410 provides interfaces for external ROM, SRAM, SDRAM, NOR Flash, and NAND Flash. The space of S3C2410 external memory is divided into 8 BANKS, each BANK has a capacity of 128M: when accessing BANKx (x from 0 to 7), the address range corresponding to x*128M to (x+1)*128M-1 SDRAM uses BANK6, and its p
[Microcontroller]
Quick debugging of S3C2410-WinCE6.0-OAL
     The previous article analyzed the startup code of S3C2410 WinCE6.0 OAL. This article then introduces the OAL transplantation process. Before continuing, let’s clarify the role of WinCE6.0 OAL. In WinCE6.0, OAL first played the role of threading the needle, which can be seen from its startup code. The second funct
[Microcontroller]
Quick debugging of S3C2410-WinCE6.0-OAL
Design of Magnetic Field Measurement System Based on S3C2410
1 Introduction With the development of science and technology, embedded operating systems play an important role in more and more fields, and have become one of the symbols of product technology level. Among them, Linux is widely used in instrument measurement equipment because of its openness, multi-user, multi-taskin
[Microcontroller]
Design of Magnetic Field Measurement System Based on S3C2410
Toshiba Launches Arm® Cortex®-M4 Microcontroller for Motor Control
Further enriching the M4K group of the TXZ+™ family advanced series, expanding the code flash memory to 512 KB/1 MB Shanghai, China, March 26, 2024 - Toshiba Electronic Devices & Storage Corporation ("Toshiba") today announced that it has added eight new products to the M4K Group of the TXZ+™ Fami
[Industrial Control]
Toshiba Launches Arm® Cortex®-M4 Microcontroller for Motor Control
A LCD screen interface design based on S3C2410A
At present, the control display of LCD screen mostly adopts single chip microcomputer, FPGA or CPLD as controller, and the programming mostly adopts assembly language or C51 program. This paper takes the small-sized LCM19264 graphic dot matrix LCD display with integrated controller and display screen as an example
[Microcontroller]
A LCD screen interface design based on S3C2410A
Detailed explanation of S3C2410 startup code (1)
      I spent a lot of time studying the boot code of S3C2410r, and finally finished it! After referring to some materials, I added my own understanding and left some notes. Some parts may be incorrect and need to be corrected:      Usually, the startup code refers to the assembly code that needs to be executed after
[Microcontroller]
Porting standard Linux operating system to S3C2410
    1 Introduction     At present, embedded processors based on ARM core have become the mainstream in the embedded system market. With the widespread application of ARM technology, the establishment of embedded operating systems for ARM architecture has become a hot topic in current research. S3C2410 is a 16/32-bit e
[Microcontroller]
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号