Design of LCD display with lunar calendar real-time clock based on ARM9

Publisher:温柔浪漫Latest update time:2011-05-24 Keywords:ARM9 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
S3C2440A is a low-power, cost-effective chip provided by Samsung for handheld device applications. S3C2440A is based on the ARM920T core, and integrates a wealth of peripheral function modules on the basis of the basic functions of the ARM920T core, such as UART, RTC, LCD controller and other peripheral devices, thereby reducing the cost of embedded application systems. This paper uses S3C2440A and WXCAT35 LCD display module to build an embedded LCD system work platform based on the two. Based on this platform, the display of the real-time clock with the lunar calendar on the LCD display, as well as the method of changing the time and setting the alarm time are discussed in detail, and the specific implementation procedures are given.

1 System Hardware Design
1.1 Real-time Clock (RTC) Module
S3C2440A integrates an RTC module with calendar function, which can work with a backup battery when the system is turned off. RTC uses STRB/LDRB ARM operations to transmit 8-bit data of binary coded decimal (BCD) to the CPU. The data includes time information of year, month, day, week, hour, minute and second. In addition, the RTC module can also realize the alarm function. The RTC module uses a 32.768 kHz external crystal oscillator. The connection between the external crystal oscillator and the S3C2440A is shown in Figure 1. XTIrtc and XTOrtc are the 32.768 kHz crystal oscillator input and output of the RTC, respectively. The two 22 pF capacitors are the matching capacitors of the crystal oscillator. Only when the external capacitors are matched capacitors can the crystal oscillator frequency be guaranteed to be within the error range near the nominal frequency.

a.jpg


1.2 Universal Asynchronous Receiver Transmission (UART) Module
The UART of S3C2440A provides three independent asynchronous serial I/O ports, each of which can operate in interrupt mode or DMA mode. The UART can support
a rate of up to 115.2 kb·s-1 using the system clock. When operating the UART, the format of the data receiving frame and the transmitting frame are programmable, which contains 1 start bit, 5 to 8 data bits, 1 optional parity bit and 1 or 2 stop bits, which are all set by the linear controller (ULCONn). This article uses UART to change the time and set the alarm time. The serial communication connection diagram is shown in Figure 2.

b.jpg [page]


1.3 LCD display module
The function of the LCD controller of S3C2440A is to transfer LCD image data from the video buffer in the system memory to the external LCD driver. The LCD control can be programmed to achieve different requirements of the screen, such as: the number of horizontal and vertical pixels, interface clock, refresh rate, etc. The connection circuit of S3C2440A and WXCAT35 LCD display module is shown in Figure 3.

c.jpg


The meaning of the LCD controller interface signals in the figure:
VFRAME: frame synchronization signal between LCD controller and LCD driver, which notifies LCD screen to display a new frame. LCD controller sends VFRAME signal after displaying a complete frame to start displaying a new frame.
VLINE: synchronization pulse signal between LCD controller and LCD driver, LCD driver uses it to display the content of horizontal shift register on LCD screen.
VCLK: pixel clock signal between LCD controller and LCD driver.
VM: AC signal used by LCD driver. LCD driver uses VM signal to change the polarity of row and column voltage used to turn on or off pixels, thereby controlling the display or extinguishing of pixels.
VD0~VD23: LCD pixel data output port.

2 Software Design
2.1 Read and Write RTC Operation
S3C2440 integrates RTC module internally. Its internal registers BCDSEC, BCDMIN, BCDHOUR, BCDDAY, BCDDATE, BCDMON and BCDYEAR store the current seconds, minutes, hours, weekdays, days, months and years respectively. The values ​​representing time are all BCD codes. The contents of these registers are readable and writable. When performing read and write operations, the 0th bit of the RTC control register RTCCON must be set to 1. The program to implement the read and write functions is as follows.
d.jpg [page]

2.2 Change time and set alarm time
Use the UART of S3C2440A to change the real-time clock and set the alarm time on the PC. The communication protocol is: when 0xaa is sent from the PC, the year, month, day, week, hour, minute and second are written to the real-time clock data register respectively. When S3C2440A receives the data, it sends 0xaa to confirm and calls the previous write operation function to change the real-time clock; when 0xbb is sent from the PC, the preset alarm time ALMYEAR (year), ALMMON (month), ALMDATE (day), ALMHOUR (hour), ALMMIN (minute) and ALMSEC (second) are written to the alarm time data register respectively. When S3C2440A receives the data, it sends 0xbb to confirm and calls the alarm time setting function to set the alarm time. By setting the alarm control register RTCALM, the alarm can be realized. The program flow chart is shown in Figure 4.

e.jpg


2.3 Lunar calendar display design
The real-time clock module of S3C2440 does not provide the time information of the lunar calendar, so the Gregorian calendar is converted to the lunar calendar to realize the display of the lunar calendar. The algorithm for converting the Gregorian calendar to the lunar calendar is: first, establish the lunar calendar data corresponding to the Gregorian calendar year and store it in an array, and then realize the conversion between the Gregorian calendar and the lunar calendar by looking up the table.
Establish the lunar calendar data corresponding to the Gregorian calendar year, and use 3 bytes to represent each year.
The high 4 bits of the first byte of the lunar calendar data corresponding to the Gregorian calendar year represent the leap year month of the lunar calendar, and the low 4 bits represent the size of the first to fourth months of the lunar calendar. The specific meanings are shown in Table 1. The second byte represents the size of the fifth to twelfth months of the lunar calendar, and the specific meanings are shown in Table 2. The highest bit of the third byte represents the size of the thirteenth month of the lunar calendar, the seventh and sixth bits represent the Gregorian calendar month of the Spring Festival, and the low 5 bits represent the Gregorian calendar date of the Spring Festival. The specific meanings are shown in Table 3.

f.jpg

g.jpg [page]

Taking 2010 as an example, there is no leap month in the lunar calendar. The first and third months of the lunar calendar are long months, and the second and fourth months are short months, so the first byte is 00001010 (i.e. 0x0A); the fifth, eighth, tenth and twelfth months of the lunar calendar are long months, and the sixth, seventh, ninth and eleventh months are short months, so the second byte is 10010101 (i.e. 0x95); since there is no leap month in the lunar calendar of 2010, there is no 13th month, so the seventh bit of the third byte is 0, and the Spring Festival of 2010 is on February 14th of the Gregorian calendar, so the sixth to the 0th bits of the third byte are 1001110, that is, the third byte is 0x4E.
The algorithm block diagram of converting the Gregorian calendar to the lunar calendar is shown in Figure 5.

h.jpg


2.4 Display of real-time clock
The read real-time clock is displayed on the LCD screen by calling the character display function. This article converts the real-time clock characters to be displayed into fonts, puts the obtained fonts in an array, reads the real-time clock register, and calls the character display function to display numbers and Chinese characters, thereby displaying the real-time clock on the LCD screen. The final display effect is shown in Figure 6.

i.jpg



3 Conclusion
A real-time clock display circuit with lunar calendar based on Samsung's ARM9 processor S3C2440 and LCD WXCAT35 is designed. In order to realize the real-time display of RTC, the RTC time beat interrupt provided in S3C2440A is used to make it interrupt once per second, read the time each time, and refresh the real-time clock. In addition, after modifying the RTC through UART, the external key interrupt is used to update the real-time clock, thereby completing the modification of the time. The design enables the real-time clock chip without lunar calendar to display the lunar calendar through software, which enhances the application range of the chip and provides convenience for working environments that require lunar calendar clock as a reference.

Keywords:ARM9 Reference address:Design of LCD display with lunar calendar real-time clock based on ARM9

Previous article:Access control monitoring system software design based on ARM9 and Linux
Next article:Remote Video Monitoring System Based on ARM and CDMA

Recommended ReadingLatest update time:2024-11-17 00:30

s3c2440 bare metal-LCD programming (5. Drawing points, lines, and circles on LCD)
1. Draw dots No matter what kind of graphics they are, they are all based on points, so we need to draw the points first, and the rest is some data processing in the upper layer. Various graphics and even colorful pictures are nothing more than points constructed. It’s just the data that comes out. We are implementi
[Microcontroller]
Design of LCD display driver IP based on NioslI
introduction The NioslI embedded processor is a SOPC solution proposed by Altera. It is a 32-bit embedded processor that users can configure and build at will. Combined with rich peripherals, it can quickly and flexibly build a powerful SOPC system. Altera provides some general IP cores, allowing users to easil
[Power Management]
Design of LCD display driver IP based on NioslI
LCD Configuration Analysis of Mini2440
I am using a W35 screen, so I will take out the W35 driver:   #elif defined(CONFIG_FB_S3C2410_W320240) #define LCD_WIDTH 320 #define LCD_HEIGHT 240 #define LCD_PIXCLOCK 170000 #define LCD_RIGHT_MARGIN 0x44 #define LCD_LEFT_MARGIN 0x04 #define LCD_HSYNC_LEN 0x01 #define LCD_UPPER_MARGIN 10 #defi
[Microcontroller]
LCD Configuration Analysis of Mini2440
How to program a digital electronic clock using 1602 LCD
    In the past, when I was learning microcontrollers, I didn't have a development board, so I felt that writing a digital electronic clock program was very difficult and I didn't know where to start. Now I am gradually familiar with various operations of microcontrollers, so I have just realized my own little design i
[Microcontroller]
PIC microcontroller realizes LCD1602 to display the letter A
PIC microcontroller LCD1602 displays a single letter A program STATUS EQU 3H ; define the status register address PORTA EQU 5H ; define the RA port data register address PORTC EQU 7H ; define RC port data register address PORTD EQU 8H ; define the RD port data register address TRISA EQU 85H ; define the RA port direct
[Microcontroller]
PIC microcontroller realizes LCD1602 to display the letter A
Source code of LCD2004 driven by ATmega16 (avr)
/*================================================ 20x4 character LCD main program, compilation software (ICCAVR_6.31) CPU internal crystal oscillator 8M data line B0~B7 connects PORTB, E=D7 RW=D6 RS=D5 ======================================================= The wiring diagram is as follows:
[Microcontroller]
STM32f4---TFTLCD display experimental code (05)
   //Different LCD drivers have different initialization settings    if(lcddev.id 0XFF||lcddev.id==0XFFFF||lcddev.id==0X9300) // ID is incorrect, add 0X9300 judgment, because 9341 will be read as 9300 if it is not reset   {         //Try to read 9341 ID         LCD_WR_REG(0XD3);               lcddev.id=LCD_RD_DATA();
[Microcontroller]
Low-level driver programming based on single-chip LCD timing diagram
Generally speaking, the control of LCD module is finally completed by MCU operating the internal register and video memory of LCD module; here we design three basic timing control programs, namely: Write register function (LCD_RegWrite) Data write function (LCD_DataWrite) Data read function (LCD_DataR
[Microcontroller]
Low-level driver programming based on single-chip LCD timing diagram
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号