1. Introduction
无忧电子开发网 http://www.51kaifa.com B0X is a cost-effective microprocessor launched by Samsung for embedded systems. It is a 16/32-bit RISC processor based on the ARM7TDMI core and has a main operating frequency of 66MHz. Human-machine interface (GUI) is an indispensable and important component of modern intelligent electronic devices. In recent years, with the continuous progress of hardware development, embedded μC/GUI has played an important role in intelligent instruments and industrial fields [1-3]. This paper discusses a μC/GUI transplantation method based on the embedded microprocessor S3C44B0X produced by Samsung. This design method has the advantages of low resource consumption, high performance, strong reliability, and easy transplantation.
2. Universal embedded graphics module μC/GUI
μC/GUI is a general-purpose embedded user graphical interface software developed by Micrium. It provides an effective graphical user interface independent of the processor and LCD controller for any application using a graphic LCD. It can be used in a single-task environment or a multi-task environment. μC/GUI can be applied to any physical display or analog display of any size of any LCD controller and CPU. It has a driver interface layer and an application layer. All codes are written in ANSI _C. Source code is provided and can be easily ported to various platforms.
2.1 μC/GUI Features
The main features of μC/GUI include: applicable to any 8-bit/16-bit/32-bit CPU, and can be used with any compiler that supports ANSI C; applicable to any controller driving any LCD (monochrome, grayscale, or color); by configuring macros, it can support any interface; configurable display size; characters and bitmaps can be displayed at any point on the LCD; an optimization process is provided for display size and speed, and the compilation time depends on the optimization process adopted; it supports virtual display, and the size of the virtual display is larger than the actual display.
2.2 μC/GUI Data Structure
μC/GUI uses its window as the basic unit of memory management, and the management of all windows is achieved by defining a heap structure. When each window is created, a continuous memory block of a specific size is allocated to it in the heap space according to its structure type, and is identified by an element in a block structure array. The definition of the block structure is as follows:
typedef struct
{
tALLOCINT Off; /*The location where the block starts in the heap*/
tALLOCINT Size; /*Size of the continuous memory block in the heap*/
HANDLE Next; /*Point to the next window pointer*/
HANDLE Prev; /*Pointer to the previous window*/
}tBlock;
static tBlock aBlock [GUI_MAXBLOCKS];
The serial number of the allocated block structure array element in the array is used as the return value to identify a window, that is, the handle. In this way, for a window, the window type structure variable that records its various attributes is placed in the heap space and has a block flag corresponding to it. In the whole process, a global structure variable GUI_Alloc is defined to store related allocation information to achieve auxiliary management of memory.
2.3 μC/GUI Working Mechanism
wuyou dianzi kaifa wangμC/GUI relies on message mechanisms and destruction functions to create, display, and delete windows. Dozens of message macros for various basic operations are defined in μC/GUI. The operation of a window is basically completed by sending message parameters to its corresponding callback function. During the entire working process, μC/GUI uses a global structure variable GUI_Context, the so-called context variable, to record information closely related to the current operation, including drawing properties, current window information, current API list, font information, etc., to manage the entire workflow.
3. S3C44B0X microprocessor
Samsung's 16/32-bit RISC processor S3C44B0X provides a cost-effective and high-performance microcontroller solution for handheld devices and general applications. Its main frequency can reach 66MHz, and its peripherals and interface expansion are rich, which greatly reduces the development cost of embedded systems.
3.1 S3C44B0X built-in LCD controller
The S3C44B0X built-in LCD controller can support black and white LCDs with specifications of 2 bits per pixel (4 gray levels) or 4 bits per pixel (16 gray levels). It can also support color LCD screens with 8 bits per pixel (256 colors). Its internal structure block diagram is shown in Figure 1.
Figure 1 LCD internal controller block diagram |
3.2 Establishing GUI hardware platform based on S3C44B0X
S3C44B0X has two operating modes: one is with an operating system, and the other is without an operating system. For the operating mode without an operating system, the system initialization and main program are run in the 2MB linear FALSH, which is connected to Bank0 of S3C44B0X. After power-on reset, the system automatically starts running from the address 0x00000000, or the program can be loaded to a specified address to start running. This article adopts the operating mode without a system, and loads the initialization program and the main program into the 2MFLASH with the first address of 0x0c008000 for running.
The development board based on S3C44B0X used by the author and the LCD-related parts mainly integrate the following devices: 2MB of FLASH; 8MB of SDRAM; user-defined logic devices; a Sharp 5.7-inch, 256-color, 320×240 resolution LCD; and an ARM JTAG interface.
Its functional block diagram is shown in Figure 2.
Figure 2 Block diagram of the relevant parts of the development board [page]
In the hardware platform, S3C44B0X allocates a dedicated DMA channel for display, which can greatly save CPU resources and make the system faster. In terms of memory, the system allocates a specified size of memory as the real screen display memory. The processor uses a dedicated DMA channel to write the data in the memory to the LCD display buffer at the specified refresh rate to realize the LCD graphical interface display.
4. Porting μC/GUI on S3C44B0X
4.1 Migration steps
The general transplantation process can be divided into the following steps:
(1) Customize the μC/GUI you need; (2) Specify the address of the hardware device and write the interface driver code; (3) Compile, link, and debug the subroutines; (4) Test, modify, and add the functions you need; (5) Write your own application. Due to space limitations, this article only gives the core steps of the transplantation: writing the interface driver code.
4.2 μC/GUI and input/output device driver interface module design
This article takes the design of LCD driver interface module as an example to introduce the writing of LCD driver in the process of μC/GUI transplantation, so as to finally realize graphic display.
The driver is mainly responsible for LCD initialization. This function completes the configuration of the 44B0X LCD controller, the mapping of the video memory, etc. This article uses the 320×240 color LCD as an example to give the writing of the initialization program. The details are as follows:
void LCD_Init(void)
{int i;
LCD_DisplayOpen(FALSE); // /* Turn off LCD display*/
for(i=0; i<320*240; i++) /* Initialize video memory*/
*(pLCDBuffer256+i) = 0x0;
rPDATD = 0xff;;
rPCOND = 0xaaaa; /* PDATD[7 :0]: initialized to 0xff */
rPUPD = 0x00; /* PCOND[15:0]: Configure as function terminal*/
/* PUPD [7 :0]: Enable the pull-up resistor of the corresponding bit (0 = enable, 1 = disable) */
rLCDCON1 = (0)|(DISMODE<<5)|(WDLY<<8)|(WLH<<10)|(CLKVAL<<12);
/* disable,8B_SNGL_SCAN,WDLY=16clk,WLH=16clk, CLKVAL=10*/
rLCDCON2 = (LINEVAL)|(HOZVAL<<10)|(LINEBLANK<<21);
/* Use color mode, LCDBANK=0xc000000, LCDBASEU=0x0 */
rLCDSADDR1= (MODESEL<<27) | (((U32)pLCDBuffer256>>22)<<21) |
M5D((U32)pLCDBuffer256>>1);
rLCDSADDR2= M5D(((U32)pLCDBuffer256+(LCDWIDTH*LCDHEIGHT))>>1) |
(MVAL<<21);
rLCDSADDR3= PAGEWIDTH | (OFFSIZE<<9);
rREDLUT = 0xfdb97531;
rGREENLUT = 0xfdb97531; /* Set the color values of red, green and blue*/
rBLUELUT = 0xfb73;
rDITHMODE = 0x0;
rDP1_2 = 0xa5a5;
rDP4_7 = 0xba5da65;
rDP3_5 = 0xa5a5f;
rDP2_3 = 0xd6b;
rDP5_7 = 0xeb7b5ed;
rDP3_4 = 0x7dbe;
rDP4_5 = 0x7ebdf;
rDP6_7 = 0x7fdfbfe; /* Enable 8-bit single scan/
rLCDCON1 = (1)|(DISMODE<<5)|(WDLY<<8)|(WLH<<10)|(CLKVAL<<12);
Delay(5000);
LCD_BkLight(TRUE); /* Turn on backlight*/
LCD_DisplayOpen(TRUE); /* Turn on LCD display*/}
After completing the LCD driver as above, set the corresponding interrupt service subroutine (IS), and μC/GUI can run stably on the S3C44B0X hardware platform. [page]
4.3 Modification of μC/GUI Configuration File Parameters
The main modification is to the configuration file LCDConf.h. For the 320×240 color LCD used in this article, the content of LCDConf.h needs to be modified as follows:
#define LCDCONF_H
#define LCD_XSIZE (320) /* LCD horizontal resolution*/
#define LCD_YSIZE (240) /* LCD vertical resolution*/
#define LCD_BITSPERPIXEL (8)
The setting of LCD register constants is not described here. In addition, the hardware platform used in this article is equipped with a 1×4 keyboard, which is connected to the I/O port of S3C44B0X. In the process of porting μC/GUI, the use of the keyboard is mainly to detect the level (0 or 1) of the corresponding I/O port to determine whether the keyboard is pressed or not.
5. GUI User Model Design
With the above μC/GUI transplantation process based on S3C44B0X, users can design GUI according to their own requirements. Figure 3 shows a test GUI designed by the author, which embodies the basic elements and ideas of GUI design.
Figure 3.3 Test user interface diagram
Figure a is a GUI for testing LCD bitmaps and keyboards, including sliding buttons, fixed buttons, and color test bars; Figure b is a commonly used sine wave test chart with a red background and white grid lines and waveforms.
6. Summary
Based on the analysis of μC/GUI principles and functions, the process of transplanting the embedded graphical user interface on the target platform based on S3C44B0X is discussed in detail, and the transplant core program - driver interface program is given. The program has been successfully tested and runs on the hardware platform, and it runs stably and has strong real-time performance.
The author's innovation lies in the integration of μC/GUI's advantages of easy transplantation, convenient and flexible use, powerful functions, and ARM processor's advantages of low power consumption, portability, and high code execution efficiency. The code can be widely used in smart terminals such as smart meters and portable devices with a slight modification, and has good application prospects.
References:
[1] Li Yan, Rong Panxiang. Principles and applications of embedded uClinux system based on S3C44B0X[M]. Beijing: Tsinghua University Press, 2005.
[2] Yang Guangyou, Zhou Guozhu, Zhang Daode, Ding Yi. Graphical interface design of embedded measurement and control instruments [J]. China Instruments and Meters. 2004. (10): 36-39
[3] Jiang Junhui. Embedded system hardware design based on ARM [J]. Microcomputer Information, Vol. 21, No. 7-2, 2005, p. 120.
[4] μC/GUI User Manual[M]. Micrium, 2003.
Previous article:Design of MPEG-4 Video Transmission System Based on IPP Library
Next article:Design of intelligent traffic signal based on S3C44B0X
Recommended ReadingLatest update time:2024-11-17 00:48
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
- Discussion on the practical ability of silicone pads
- Shenzhen Electronic Hardware Engineer
- "Blink" on the "New Version of Bluesight AB32VG1 RISC-V Development Board"
- Share a book about Cortex M3 core
- msp430 MCU AD conversion
- Fudan Micro FM33LC046N Evaluation + ADC Collection Alarm
- MSP430FR235x-based pulse oximeter system solution
- CCS compilation error: Solution for missing header file
- LWIP uses UDP to send data continuously
- It was very popular in the past, and now it is back, how should this button position be designed?